1- let marks = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] ; // Array Declearation
1+ let marks = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] ; // Array Declaration
22
3- // If we want 1 to 3 as diffrent variables and 4 to 9 as full array then in such cases we use "rest" operator
3+ // If we want 1 to 3 as different variables and 4 to 9 as full array then in such cases we use "rest" operator
44
55let [ first , second , third , ...remaining ] = marks ;
66
@@ -15,7 +15,7 @@ let a = {
1515 college : "SIES"
1616} ;
1717
18- let { name , age, ...unwanted } = a ; // Here in unwanted all key and values expect the name and age will come this is diffrent than arrays
18+ let { name , age, ...unwanted } = a ; // Here in unwanted all key and values expect the name and age will come this is different than arrays
1919
2020console . log ( unwanted ) ; // Output { branch: 'Comps', college: 'SIES' }
2121
@@ -26,7 +26,7 @@ let array1 = [1,2,3,4,5,6];
2626
2727let array2 = [ 6 , 7 , 8 , 9 , 10 ] ;
2828
29- let combinedArray = [ ...array1 , ...array2 ] ; // Here "..." are considerd as spread operation we are spreading the two arrays into one
29+ let combinedArray = [ ...array1 , ...array2 ] ; // Here "..." are considered as spread operation we are spreading the two arrays into one
3030
3131console . log ( combinedArray ) ;
3232/* Output
0 commit comments