Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

copy of array and object in javascript

// for copy array and object we use ...(spread operator in js)
const rating = [4,3,5,2]
const descRating = [...ratings]
descRating.sort((a,b)=> b-a) //for ascending use a-b
 
PREVIOUS NEXT
Tagged: #copy #array #object #javascript
ADD COMMENT
Topic
Name
6+7 =