Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

destructure dynamic property

let object = {x: 3, y: 6}
let propertyName = 'x'

// the value of the destructured property is assigned to a new variable
let {[propertyName]: value} = object

console.log(value) // 3
Comment

PREVIOUS NEXT
Code Example
Javascript :: js matrix 
Javascript :: ex. javascript loop aray 
Javascript :: react update component after api call 
Javascript :: js insert before 
Javascript :: show ajax error wordpress 
Javascript :: how to check checked checkbox in jquery 
Javascript :: sass config.json vs code 
Javascript :: js replace all 
Javascript :: add zero in front of numbers javascript 
Javascript :: javascript remove trailing slash 
Javascript :: how to get all form values in javascript 
Javascript :: javascript newline in alert 
Javascript :: download text file javascript 
Javascript :: javascript parse json 
Javascript :: npm for node types 
Javascript :: should i use google pay 
Javascript :: zoom out browser javascript 
Javascript :: object exists in array javascript 
Javascript :: add tailwind to create react app 
Javascript :: save text to file nodejs 
Javascript :: toast in react native 
Javascript :: file upload with angular material 
Javascript :: javascript foreach index 
Javascript :: check if type is blob javascript 
Javascript :: do while loop 
Javascript :: como calcular porcentaje en javascript 
Javascript :: control audio javascript 
Javascript :: npm uniqueid 
Javascript :: get looping in jquery 
Javascript :: csurf npm 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =