How to check two numbers are approximately equal in JavaScript?

Kalyan Mishra
Updated on 26-Jul-2022 13:52:05

695 Views

In this tutorial, we will check if two numbers are approximately equal or not. In case given two numbers are equal then we will print yes, it is otherwise not it’s not.But let me make you clear that we are not going to do any magic here, basically we will also have to give an epsilon value.So, when we calculate the absolute difference between those two numbers and then compare with the epsilon then if absolute difference is lesser than the epsilon then the numbers are approximately equal else not approximately equal.Suppose two numbers given is 6.79 and 6.75 and ... Read More

How to return true if the bottom of the page is visible using JavaScript?

Prince Varshney
Updated on 26-Jul-2022 08:54:57

1K+ Views

In this tutorial, we will check if the bottom part of a page is visible or not to the user. We can do this functionality by using the height of the window and the height of the scrolled window. To write this code we need to understand three methods of JavaScript which are given asscrollY − It is the read-only property of the window, and returns the pixels a document has scrolled vertically.window.scrollYscrollHeight −It is an HTML DOM element and a read-only property of the window. It returns the height of an element’s content including the content that is not ... Read More

How to pause and play a loop using event listeners in JavaScript?

Prince Varshney
Updated on 26-Jul-2022 08:50:15

1K+ Views

In this article, we are going to understand how we can pause and play a loop whenever we want using event listeners and promises in JavaScript. Pause and play to a loop refers to as a for loop is running and we want to make a pause in between any position in a loop or want to play it again.An event listener can be attached to any element to control how the event reacts to bubbling. It attaches an event handler to an element.SyntaxFollowing is the syntax of an event listener −element.addEventListener(event, function, useCapture);Parametersevent − it is the name of ... Read More

How to check the current runtime environment is a browser in JavaScript?

Prince Varshney
Updated on 26-Jul-2022 08:38:51

3K+ Views

A runtime environment is an environment where your code will be executed. It tells what global objects your code can access and it also impacts its result. A JavaScript code can run in different types of environments some of them are Node.js, Service Workers, or in a web browser. So, to start coding in JavaScript, you don’t have to install any additional software. Each web browser comes with a JavaScript engine. You can simply run scripts you write inside any browser but it ensures that it follows all the rules of the ECMAScript (ES6) functionality.Here we will detect in which ... Read More

How do you reverse a string in place in JavaScript?

Shubham Vora
Updated on 26-Jul-2022 07:37:53

2K+ Views

In this tutorial, we will learn to reverse a string in place in JavaScript. How to reverse a string is one of the most popular questions asked in the interview of freshers. It’s an easy task but the interviewer can be tricky and make the same question difficult for you. For example, what if the interviewer asks you to write a pseudo code to reverse a string in place without using the extra space? You should have an answer ready in your mind for this kind of tricky question.There are lots of ways to reverse a string. As developers develop ... Read More

Difference between Stack and Array

Pradeep Kumar
Updated on 25-Jul-2022 10:22:58

8K+ Views

The storing and arranging of data in a predefined format so that it can be retrieved and modified in efficient ways is one of the many things that you will want to accomplish, and Data Structures are the building blocks that make it possible. Data Structures are essentially logical representations of data that are used to store data in an ordered fashion in order to facilitate the execution of a variety of operations on the data.Within a single computer programme, we have access to a variety of different ways to store and retrieve information. If you are using an object-oriented ... Read More

Difference between MapReduce and Spark

Pradeep Kumar
Updated on 25-Jul-2022 10:20:21

2K+ Views

Both MapReduce and Spark are examples of so-called frameworks because they make it possible to construct flagship products in the field of big data analytics. The Apache Software Foundation is responsible for maintaining these frameworks as open-source projects.MapReduce, also known as Hadoop MapReduce, is a framework that enables application writing, which in turn enables the processing of vast amounts of data on clusters in a distributed form while maintaining fault tolerance and reliability. The MapReduce model is constructed by separating the term "MapReduce" into its component parts, "Map, " which refers to the activity that must come first in the ... Read More

Difference between JUnit and TestNG

Pradeep Kumar
Updated on 25-Jul-2022 10:18:33

9K+ Views

Software Testing is an important phase in the software development lifecycle because it involves locating and identifying bugs in the programme as well as ensuring that the software is error free. Testing is analogous to "quality control" and is what guarantees quality in the development of software. Unit testing, integration testing, functional testing, performance testing, acceptance testing, etc., are just some of the many types of testing that are performed at various points throughout the process.Unit testing is carried out concurrently with the coding of a computer programme or application. In this type of testing, the smaller, more easily testable ... Read More

Difference between IaaS and PaaS

Pradeep Kumar
Updated on 25-Jul-2022 10:16:19

544 Views

The cloud is a hot topic for companies of all sizes, from start-ups to multinational corporations. It is more important than ever to gain an insight into the distinctions between the various cloud services as well as the benefits they offer before migrating your company's operations to the cloud, whether it be for the deployment of applications or infrastructure.Read through this article to get a clear understanding of IaaS and PaaS, and how these two cloud services are different from each other.What is IaaS?IaaS, which stands for Infrastructure as a Service, is a model for providing computing infrastructure in the ... Read More

Difference between Hadoop and MongoDB

Pradeep Kumar
Updated on 25-Jul-2022 09:43:53

917 Views

Hadoop was built to store and analyze large volumes of data across several computer clusters. It's a group of software programs that construct a data processing framework. This Java-based framework can process enormous amounts of data quickly and cheaply.Hadoop's core elements include HDFS, MapReduce, and the Hadoop ecosystem. The Hadoop ecosystem is made up of many modules that help with system coding, cluster management, data storage, and analytical operations. Hadoop MapReduce helps analyze enormous amounts of organized and unstructured data. Hadoop's parallel processing uses MapReduce, while Hadoop is an Apache Software Foundation trademark.Millions of people use MongoDB, an open-source NoSQL ... Read More

Advertisements