Open yogeshtakeo opened 1 year ago
Name: Sandesh Shrestha
Git URL: https://github.com/yogeshtakeo/task_BFD30/tree/Sandesh/folder-structure-and-js-concepts
Namkhang Tsamchoe git url: https://github.com/yogeshtakeo/task_BFD30/tree/namkhang/folder_structure_and_js_concepts
Github URL: https://github.com/yogeshtakeo/task_BFD30.git
Task 8: Folder Structure in Vite Environment and JavaScript Concepts
Objective:
Create a folder structure for a Vite environment and practice JavaScript concepts including the
map()
method, array destructuring, rest parameter, object destructuring, and spread operator.Task Overview
map()
method to transform an array.Task Details
Folder Structure in Vite Environment:
Open a terminal or command prompt. Create a new directory for your react project
npx create-vite@latest vite-folder-structure
andcd vite-folder-structure
Familiarize yourself with the default folder structure created by Vite, including the src directory for source files, public directory for static assets, and the main index.html file.
Transform Array using map():
main.js
or any other file you create).map()
method to transform the array by doubling each number.Array Destructuring:
[1, 2, 3, 4, 5]
).Rest Parameter
Object Destructuring:
Spread Operator:
Declare two arrays with values (e.g., [1, 2, 3] and [4, 5, 6]). Use the spread operator to combine the arrays into a single array. Print the combined array to the console. Use the spread operator to clone the original array into a new array. Print the cloned array to the console.
Task Submission