Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

JavaScript Extract Values

const data = {
    "Name": "John Doe",
    "Age": 99,
    "Gender": "m",
    "Childs": ["Max", "Anna", "Phil"]
}

// Properties with Variablename = Propertyname
var { Name, Age, Gender } = data;
console.log(Name + " is " + Age + "Year old.");

// Properties with custom Variablename
var { Name: n } = data;
console.log(n);

// Extract Array
var { Childs } = data;
console.log(Childs);

// Extract from Array
var [child1, child2, child3] = Childs;
console.log("First: " + child1 + ", Second: " + child2, ", Third: " + child3);
Comment

PREVIOUS NEXT
Code Example
Javascript :: fibonacci recursive method 
Javascript :: onscroll load more in vue native 
Javascript :: d-block d-none js 
Javascript :: The above error occurred in the <Provider2 component: 
Javascript :: change height of div with scroll in javascript 
Javascript :: use the AJAX XMLHttpRequest object in Javascript to send json data to the server 
Javascript :: check a letter in astring js 
Javascript :: inline styling to change background color 
Javascript :: duplicate text javascript 
Javascript :: library for react table 
Javascript :: nodejs mysql transactions 
Javascript :: mongoose express js post 
Javascript :: js clone obj 
Javascript :: why to use arrow functions over normal function 
Javascript :: if condition javascript 
Javascript :: javascript constructor 
Javascript :: how to select default searchable dropdown value in jquery 
Javascript :: js remove all attributes from element 
Javascript :: es6 spread assign nested object 
Javascript :: react native date time picker modal 
Javascript :: string javascript concatenation 
Javascript :: Simplest Promise Example 
Javascript :: how to add icon in javascript 
Javascript :: superagent vs axios 
Javascript :: send a message in every guild discord.js 
Javascript :: form changes button enable reactive forms 
Javascript :: Check Object Is Instance Of Class 
Javascript :: store fetch data in variable javascript 
Javascript :: pass function with parameter as prop 
Javascript :: toast show pb 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =