Modern Javascript — Part 1

🔥 let

  • When you use let keyword with your code, that means it is not visible to the outside of scope.
  • Ex: Have a look on below code. In here, is I ask the value of “i and k”, you will say respectively k=4 and i=5. But the results is not that.
  • Now, I use above code and change led into const.
  • The first way: Use function keyword and create function to calculate area.
  • The second way: we do not use function keyword. Instead of that we define a variable to get area. You cans see here, an arrow is connecting our function and function body.
  • The third way: We can write a function as below. In here we do not have curly braces.
  • The forth way: In our function if we take only one argument, we can write as below.
  • The fifth way: If you want to print something on console related with function you can do it in this way.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store