Some Javascript problem solving for Interview
Scope
In javascript, Scope determines the visibility of variables. If you declare variable outside of any function, you can call it from anywhere you want. But if you declare variable inside of a function, you can call only into the function, you can’t call the variable outside the function. Let’s see an example to clear it
Sum of all Array
With this method you can sum all the numbers into an array. let’s see how to sum all numbers in the array. The method is too easy.
Remove Duplicate Number
Today I worked with a problem which is how to remove duplicate number from an array. So I am showing you, if you get the problem you can fix it with this code. Here the code is below.
map()
The map() method calls the provided function once for each element in an array. It works like loop, but it will stop when the array element will be end. Here’s an example how to use it
Fibonacci
Fibonacci numbers are a series of numbers that every number in the series after the first two is the sum of the next ones. The series starts with 0, 1. Fibonacci is a popular question in interview. So here I try to solve the problem. Here You can see my code.
Factorial
Factorial is a multiply its lower number until its get to 1. For example, 7 factorial = 7*6*5*4*3*2*1. Let’s see an example
filter() and find() in Array
filter() in javascript is used to get all the number after its dependencies complete. And find() in javascript is used to get the first the number after its dependencies complete. Let’s see an example
Word Count
Word Count in Javascript is a popular interview problem solving. You can do it like I did in my code. Here I am giving the code below.
Reverse String
Reverse String in Javascript is also a popular interview problem solving. So I tried it, and I did it so well. Let’s see the code.
Prime Number
Prime Number means the number that can’t be devided by any number without 1 and that number. Checking Prime Number in Javascript is also a popular interview problem solving. For this you need to do some Javascript code. Here you can see my code.