Horje
Javascript using for loop to loop through an array Code Example
Javascript using for loop to loop through an array
// Durations are in minutes 
const tasks = [
  {
    'name'     : 'Write for Envato Tuts+',
    'duration' : 120
  },
  {
    'name'     : 'Work out',
    'duration' : 60
  },
  {
    'name'     : 'Procrastinate on Duolingo',
    'duration' : 240
  }
];

const task_names = [];
 
for (let i = 0, max = tasks.length; i < max; i += 1) {
    task_names.push(tasks[i].name);
}

console.log(task_names) // [ 'Write for Envato Tuts+', 'Work out', 'Procrastinate on Duolingo' ]




Javascript

Related
disable google analytics gatsby config.js Code Example disable google analytics gatsby config.js Code Example
javascript firebase kicks out current user Code Example javascript firebase kicks out current user Code Example
//Splice remove and add new elements in an array in javascript Code Example //Splice remove and add new elements in an array in javascript Code Example
Show and Hide element in react Code Example Show and Hide element in react Code Example
javascript regex zero or more occurrence Code Example javascript regex zero or more occurrence Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8