Array in Javascript


Method 2:  

var city = \["London", "Cambridge", "Oxford", "Manchester"\];


method 2 uses an array...  

....which stores multiple values in a single variable  

  • More suitable for storing large numbers of items/data items as it  reduces the complexity of the code  
  • Increases the code easier to understand  
  • Increases the execution speed of the code  
  • Method 2 can be looped through using an iterative function  
  • ...to find a specific data item  

  

  

  


Comments