
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

29K+ Views
In this tutorial, we will learn to check if the variable is a Boolean in JavaScript. In JavaScript, if we match the two different variables with the same value and different data types using the equality operator, it returns a true value. It means if we compare a twovariable with the true value but different data types such as Boolean and string, it will generate a positive result. To overcome these problems, we need to check if the variable is of type Boolean or not before matching it with other values. Users can use the three methods below to check ... Read More

2K+ Views
To declare a Boolean in JavaScript, you need to assign true or false value.var answer = true;ExampleTo learn about the working of Boolean, let’s see the following example −Live Demo JavaScript Boolean var num1 = 10; var num2 = 20; document.write(num1 > num2);

23K+ Views
In this tutorial, we will discuss how we can check for a number whether it is a decimal number or a whole number using the JavaScript. In JavaScript, we can use in−built methods as well as the user defined methods to check for a number if it has a decimal place or it is a whole number. We will discuss about all those methods in details. Let us see what are those methods that we can use to accomplish this task. Following methods are very useful to check for a number if it is decimal or whole number − ... Read More

1K+ Views
We have given a number and the task is to calculate the nth root of that number using JavaScript. We have multiple ways to achieve this, some of which are the following. Using Math.pow() Method Using Logarithm To get the nth root of a number firstly let’s understand whose root we can calculate and which number’s root we cannot calculate. If the number is positive and the root is also even then we will get two solutions. E.g − 2nd root of 16 is +4 and -4, similarly 4th root of 16 is +2 and -2 If ... Read More

26K+ Views
In this tutorial, we will learn to check whether a value is a number in JavaScript. In JavaScript, it is necessary to check the variable's data type while performing some operation. Otherwise, it can create some unknown bugs in your application. For example, when users use the addition operator with the string, it concatenates the two strings, and in the same way, if users use the addition operator with a number, it adds two numbers. Now, think that the user wants to add two numbers but is concatenating the two strings. Here, we have three different methods to check whether ... Read More

32K+ Views
In this tutorial, we will learn to round a number to a one decimal place in JavaScript. There are various needs to round the float numbers and show particular digits after the decimal point. In our case, we need to show only the digit after the decimal point. However, we will create a customizable manual function that can round off the number and show the particular number of digits after the decimal point at the end of this tutorial. This example lets users understand the fundamental need to round a number to a single decimal digit. Suppose the scenario where ... Read More

12K+ Views
This tutorial teaches us to force clients to refresh JavaScript files. Now, the question is, why do we need to force clients to refresh the JavaScript files? Let’s understand it by example issue. Suppose we have deployed the application and lots of users are using our application. Now, to improve the performance and UI of the application, we will continuously work on our application and upgrade its version after every period. Obviously, after upgrading our application’s version, we will also push that into production. But sometimes, on the user's screen, client-side JavaScript or CSS is not upgraded, and it shows the ... Read More

2K+ Views
The space on the number line between any integer and zero is known as its absolute value. No negative values exist because it is the distance. This tutorial will help you find a number's absolute value in JavaScript. Next, we will see the method to find the absolute value of a number in JavaScript. Using Math.abs() A number's absolute value is returned using the Math.abs() function. If n is positive or zero, it returns n, and if n is negative, it returns the negation of n. The Math.abs() is a static function of Math. Hence, we use it as it ... Read More

274 Views
parseInt(string)The parseInt() method parses up to the first non-digit and returns the parsed value. For example, the following returns 765:parseInt("765world")Let’s take another example. The following returns 50:parseInt(‘50px”);Number(string)Number() converts the string into a number, which can also be a float BTW.For example, the following returns NaN:Number(“765world”)The following returns NaN:Number(“50px”);

272 Views
The void operator is used to evaluate the given expression. After that, it returns undefined. It obtains the undefined primitive value, using void(0).If inserting an expression into a web page results in unwanted effect, then use JavaScript void to remove it. Adding JavaScript:Void(0), returns the undefined primitive value.The void operator is used to evaluate the given expression. After that, it returns undefined. It obtains the undefined primitive value, using void(0).We used JavaScript:void(0) above to prevent the page from reloading when the button is clicked the first time.It only works when the button will be clicked twice. If it is clicked ... Read More