Module-21 Practice Section

Video 21-0 What are function

Video21-1 :JS Concepts recap, var, let, and const

Video 21-2 :21-2 Unit Convert Inch to Feet, miles to kilometer

Video 21-3: Check even and odd number using function

Video 21-4 Check whether a year is a Leap Year or not (simplified way)

Search google: javascript leap year logic

21-5 : Calculate Sum of all numbers of an array

21-6 Get Odd Numbers of an array and get odd Sum of an array

21-7 : Calculate Factorial of a number using for loop

21-8 : Factorial using a while loop or a decrementing loop

21-9 : Module Summary and Simple JavaScript debug

QUIZ

Q1: Fill in the blanks.
function inchToFeet(___){ var feet = inch/12; _____ feet; }
Ans: inch, return

Q2: What is a scripting language? (just google it and even you do not understand anything)
Ans: A programming language that is interpreted, code translated into machine code when the code is run, Scripting
language are often used for short scripts

Q3: Which one is not true? (Just google “interpreted vs compiled language” and read the freecodecamp.org article even you do not understand anything)
Ans: javascript is a compiled language

Q4: Which one is not equal to 6!? (just checking)
Ans: 6*5*3!

Q5: Which one of the following cannot be used at the time of declaring a variable in JavaScript? (be careful)
Ans: const

Q6: which one will give you an odd number?
Ans: num%2 ==1

Q7: Fill in the blank to see 10 numbers as output?
for(let i = 0; _____?_____; i++){ }
Ans: i< 10

Q8: Fill the blank for 10 numbers decrementing loop? for( let i = 10; ______?_____; i--){ }
Ans: i>= 1

Q9: What will be the output?
function print(a, b, c){
return a+2;
return a*b;
return b*c+a;
} console.log(print(1,2,3));
Ans: 3

Q10: Which is not correct?
Ans: if(item => 50){};

The End