what are the difference between double equal(==) and triple equal(===)?
Double equal will check only the value. But the triple equal will check not only the value but also the type.
Find the largest element of an array
At first, you need to declare an array. Then you need to declare another variable to count the element number of that array. In this case, the count starts from 0. At last, you need to declare a simple for loop to find the largest element of that array.
Reverse a string
In the tricks, you will be able to reverse your desired string. As you can see in the picture given below, the main string is “ngoJ si mean yM”. If you reverse it by applying a simple function, the output result will be “My name is John”.
In this process, firstly you need to declare a variable in the function which default value is an empty string. After that, you need to declare a loop to reverse the current string values. Finally, this function will reverse your desired string.
Calculate Factorial in a Recursive function
After dividing a number, if its remainder is zero, then it is a prime number. In the picture giver below, ‘%’ this sign is called modulus
Remove duplicate item from an array
This trick is quite interesting. In this trick, you will learn how you can remove duplicate items from an array. At first, you need to declare an array with some duplicate items in it. After that, declare an empty array which will give you the output result. Finally, run a loop to find out the duplicate items on the array.
Count the number of words in a string
In this trick, you will be able to count the total word number in any string. It's cool!!….isn't it? First of all, you need to declare a variable with to store some strings in it. For counting these strings, you need to declare another variable which default value is zero. Finally, you need to run a loop with some logical commands to count the number of words in a string. That’s it!!!