var array1 = ['Hamburger', 'Fries']
var array2 = ['Salad', 'Fruits']
var combinedArray = array1.concat(array2); // => ['Hamburger', 'Fries', 'Salad', 'Fruits']
// object.fromEntries Explain
// Note : it's work with array of an array
let name =['noor','alex','biker','hosler']
let ages = [ 11 , 13 , 15 , 17];
const newvalue=(
name.map((nameArrayElement,index)=>{
return [nameArrayElement,ages[index]]
})
)
console.log(newvalue);
// output without using fromEntries
// [ [ 'noor', 11 ], [ 'alex', 13 ], [ 'biker', 15 ], [ 'hosler', 17 ] ]
const newvalueAfterFromEntries=Object.fromEntries(
name.map((nameArrayElement,index)=>{
return [nameArrayElement,ages[index]]
})
)
console.log(newvalueAfterFromEntries);
// Output AfterFromEntries
// { noor: 11, alex: 13, biker: 15, hosler: 17 }
// By Noor Mohammad Patwary
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!