Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

object fromentries example

const entries = [
  ['foo', 'bar'],
  ['baz', 42]
];

Object.fromEntries(entries)
Comment

object.fromentries

// 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
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to convert an object to a list in js 
Javascript :: import svg as react component 
Javascript :: spining load react component 
Javascript :: webpack setup proxy manual 
Javascript :: randomize an array in javascript 
Javascript :: javascript object 
Javascript :: check if number is float 
Javascript :: react native navigation remove top header screen 
Javascript :: async await class component react 
Javascript :: js mb to bytes 
Javascript :: setting usestate to prop 
Javascript :: comparing two arrays in javascript 
Javascript :: javascript hello 
Javascript :: how to give css style in javascript 
Javascript :: phone number with dashes 
Javascript :: discord.js start 
Javascript :: reverse json.stringify 
Javascript :: useeffect 
Javascript :: Pass Props to a Component Using default parameters in react 
Javascript :: jquery with npm in laravel 
Javascript :: foreach 
Javascript :: Cannot unpack array with string keys 
Javascript :: require mongoose 
Javascript :: angular socket.io with token header 
Javascript :: jquery timepicker 
Javascript :: how reliable is js hasownproperty 
Javascript :: reflect javascript 
Javascript :: create excel sheet in javascript 
Javascript :: how to auto refresh page in javascript 
Javascript :: react lazy load suspense 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =