Skip to content

LovesPictures/CardioDay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Project 4: CardioDay

Made with vanilla JavaScript

Judith Ricketts, Artist, Lecturer and Software engineer - Contact
Commit Date: 26th October 2021

Guide

Javascript array methods are arrays forming a data structure containing list of elements which store multiple values in a single variable. The strength of JavaScript arrays lies in the array methods which are built-in functions we can apply to our arrays. Each method has a unique function that performs a change or calculation to our array, saving having to write common functions from scratch.

image

long version of the code

const ordered = inventors.sort(function(a,b){
    if(a.year > b.year) {
          return 1;
   } else {
    return -1;
   }
});    
console.table(ordered);

short verson or ternary version of the above code

const ordered = inventors.sort((a,b) => a.year > b.year ? 1 : -1);
console.table(ordered);

Approach

To use arrays to sortcut operations

Useful links

Releases

No releases published

Packages

No packages published

Languages