Skip to content

Instantly share code, notes, and snippets.

@sanjeev-io
sanjeev-io / js-fundamentals.md
Created December 24, 2018 03:05
JavaScript Fundamentals Queries
  1. The version of JS that I learn, version 5 and ES6, are those the versions that majority of code written in 2018 and will be in early 2019?
  2. Will I learn about Babel / WebPack etc?
  3. Does this course cover the frontend JS as mush as JS for backend? One more than the other?
  4. Will I learn everything in JS I need to make it easy for me to master React?
  5. I am stuck, I really do NOT have any other question at this stage. If and when I do, I will add it here.

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.

1. What is scope? Your explanation should include the idea of global vs. block scope. A scope is locale accessible to a variable based on where its declared. There can only be two scopes, global or local. A local scope is the one where variable is declared within a function, whereas a global scope if for varaibles declared anywhere else outside of a function. Global scopes can be mutated from anywhere in the code file or files, whereas the local scoped variables can only be changed within the function and then it will disappear after the function is invoked, without making any changes to the outside world. Its always recommended to create local scoped variables for reliable code, unless in exceptional edge cases where global scoped variable is a must.

Why are global variables avoided? It allows for mutation of variables in unknown places, making the code prone to unintended results, and hence making