Everything you need to know about JavaScript!!

Pricilla Bilavendran
6 min readMar 11, 2021

When I started learning JS, I used many sources.

And of course I have written few articles on JS functions and methods. So I thought of clubbing the simple tricks and basics for JS in single place.

Lets start with the variables.

1.Variables:

var, const, let

var: The most common variable. Can be reassigned but only accessed within a function. Variables defined with var move to the top when code is executed.

const: Cannot be reassigned and not accessible before they appear within the code.

let: Similar to const, however, the let variable can be reassigned but not re-declared.

2. Array Methods:

  • concat(): Join several arrays into one
  • indexOf(): Returns the first position at which a given element appears in an array
  • join(): Combine elements of an array into a single string and return the string
  • lastIndexOf(): Gives the last position at which a given element appears in an array
  • pop(): Removes the last element of an array
  • push(): Adds a new element at the end
  • reverse(): Reverse the order of the elements in an array
  • shift(): Remove the first element of an array
  • slice(): Pulls a copy of a portion of an array into a…

--

--

Pricilla Bilavendran
Pricilla Bilavendran

No responses yet