Calculating factorial using for loop, while loop and in a recursive way
Creating Fibonacci series using for loop, while loop and in a recursive way
Checking whether a number is Prime or not
Finding the largest element in an array
Reversing a string
Counting words in a string
Removing duplicate elements from an array
1. Null vs Undefined
So this is one of the most confusing parts for freshers. What is null? If you check its type, you will be surprised to see that it is object. However null is a primitive value. Undefined means declaring a variable without assigning a value to it. You can get undefined in some cases. 1. When you implicitly return a function without a return statement, 2. setting undefined to something as value. 3. when you don’t pass parameters to function etc.