Skip to content

Instantly share code, notes, and snippets.

@sanjeev-io
Created December 24, 2018 06:33
Show Gist options
  • Save sanjeev-io/789a90c9e6eab07eded78dde91fb50c1 to your computer and use it in GitHub Desktop.
Save sanjeev-io/789a90c9e6eab07eded78dde91fb50c1 to your computer and use it in GitHub Desktop.

If you want to create a variable called mentor and set its value equal to the name of your mentor, how would you do that?

let mentor = "Patrick Ford";

How would you then log the value of mentor to the console?

console.log(mentor);

Describe the difference between let, var, and const.

var is legacy method of assigning variables where as let and const are the widely used proper mehod for assigning variables post es2015 or ES6.

Let is used to define the value that may change in program where as const is used for constants whose value can not be reassigned, doing that will throw reference error.

Using var, let and const create 3 variables that will hold your name, state, and hair color.

const name = "Sanjeev Jha"; let state = "Janakpur"; let hairColor = "Black";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment