

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Pulling data from array into new independent variables - JavaScript?
For this, you can use the dot(.) notation.
Example
Following is the code −
const employeeDetails = [ { employeeName: "Chris", employeeAge: 25, employeeTechnology: "Java" }, { employeeName: "David", employeeAge: 27, employeeTechnology: "Javascript" }, { employeeName: "Bob", employeeAge: 24, employeeTechnology: "Python" } ] var firstName = employeeDetails[1].employeeName; var age = employeeDetails[1].employeeAge; var technology = employeeDetails[1].employeeTechnology; console.log(firstName); console.log(age); console.log(technology);
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo248.js.
Output
This will produce the following output on console −
PS C:\Users\Amit\javascript-code> node demo248.js David 27 Javascript
- Related Questions & Answers
- Separating data type from array into groups in JavaScript
- Searching and pulling Docker Images from Dockerhub
- How to add two arrays into a new array in JavaScript?
- Create new array without impacting values from old array in JavaScript?
- Differentiate between categorical and numerical independent variables in R.
- JavaScript creating an array from JSON data?
- map() array of object titles into a new array based on other property value JavaScript
- Merge arrays into a new object array in Java
- Formatting JavaScript Object to new Array
- Convert array into array of subarrays - JavaScript
- Insert data into inner array in MongoDB?
- How to read data from JSON array using JavaScript?
- Convert 2d tabular data entries into an array of objects in JavaScript
- How to add a new object into a JavaScript array after map and check condition?
- Create scatterplot for two dependent variables and one independent variable in R.
Advertisements