Posts

Showing posts from April, 2023

Reviewing functions and some keyboard shortcuts.

Image
The return statement immediately exits or immediately returns the function and in both the if/else condition in the above code, console.log statement is after the return keyword, therefore they simply gets ignored and have no chance to get executed . If we want them to execute they should be written before the return keyword like we will do in our next example code. In vs code we can simply move up or down our code by pressing : option and up arrow keys together on mac alt and up arrow keys together on windows also command and d keys pressed together highlights the same line in the entire code. In this code the console.log statement is before the return keyword , so the statements gets printed. In vs code if we press shift + () keys together over a selected code, the entire code is wrapped around paranthesis.

functions calling other functions

Image
 

All about Arrow functions

Image
  1) Arrow functions when there is one parameter and one line of code. 2) Arrow function when there is one parameter and more than one line of code. 3) Arrow function when there is more than one parameter and more than one line of code.

function Declarations VS function expression

Image
  1) Basic syntax difference between them 2) We can call/ Invoke function declaration before it is defined, but with function expression it will show an error

Fundamentals of Functions

Image
  1)  Declaring a Function 2) Using Return keyword 3)  Using Return keyword second Example