JS Language

17 July 2018

In the JavaScript language, describe all the use cases for each of:

Parentheses ( )

  • Execute a function, e.g. var result = doSomething( )
  • Grouping Expressions, e.g c = (9+3) * 8
  • Containing Expressions, e.g. if (a < 13) { }

  • Brackets [ ]

  • To create arrays, e.g. board.cells[i]["surroundingMines"] =

  • Braces { }

  • When defining a JSON Object, e.g. var myJSON = {name : "Henry", age : 23}
  • Function, e.g. function playGuitar(guitarName) { }
  • Looping or Conditional statements, e.g. if(true) { }

  • Single Quotes ' ' and Double Quotes " "

  • Can be used interchangeably
  • Used to encase a string, which can be words or numbers

  • HOME