// 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
var ar = ["apple","banana","canaple"];
var bar = Array.from(ar);
alert(bar[1]); // alerts 'banana'
// Notes: this is for in In ES6, works for an object of arrays too!
// (May not be applicable for deep-copy situations?)
const Arr = JSON.parse(JSON.stringify([targetArray])) //Deepest Copy
const originalArr = ['NodeJs', 'Django', 'Laravel'];
const copyArr = [ ...originalArr, 'Spring Boot']; // copyArr => ['NodeJs', 'Django', 'Laravel', 'Spring Boot']