Tricky Questions of JavaScript

1.What is Reverse String:

Reverse String means inverted string. Suppose you have a string and you want this string will start from the last word to the first word. For your doubt, there is an example below :

2.What is the difference between Null Vs Undefined:

Null is a value that indicates a deliberate non-value and Undefined means that it is an uninitialized variable that hasn’t even been assigned yet.

3. Describe the ‘This’ keyword:

This keyword is used depending on where it is used. In a method section, it is used as the owner object. In a function section, it is used as a global object but if this function section refers to strict mode, its value is undefined. In an event, it refers to the element that received the event.

4.How Javascript works event loop stack and queue:

when we call a function in javascript, there is an event loop and the called functions make a stack together. All called functions stay as a frame in the stack step by step. Then, Javascript executes the frames. After executing all frame then it comes to the queue. It is the process of event loop stack and queue.

5. How to find the largest element of an array?

Solution:

6. What is ‘Event bubble’ :

When an event happens on an element, the handlers run in first and after that run the parent of this element then all the way up on other. It is the principle of event bubble.

7. What is an API and what is the purpose of API:

API(Application Programming Interface) is software that two application to talk to each other. It helps to frontend side of a website to receive data from the backend. Suppose, you have some data for your website and you store those data on a backend server but now you need those data to show on the frontend and then you need API to call those data. Now can understand that API makes a relation between frontend and backend.

8.What is DOM:

DOM(Document Object Model) is an interface of HTML that we write in the editor and the website shows our coding result on web pages. Basically, Dom helps to show the result. The DOM is an object-oriented representation of the web page.

9. Check whether a number is a Prime Number or not:

Solution:

10.Count the number of words in a string:

Solution:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store