Prince Varshney has Published 22 Articles

How to design hit the mouse game using HTML, CSS and JavaScript?

Prince Varshney

Prince Varshney

Updated on 18-Oct-2022 12:03:55

385 Views

In this tutorial, we are going to build the famous hit the mouse game using HTML, CSS, and vanilla JavaScript. Many of you wondering what is Vanilla JavaScript, it is nothing just plain JavaScript written without the use of any libraries. In the hit the mouse game, the player needs ... Read More

How to Create Pong Game in JavaScript?

Prince Varshney

Prince Varshney

Updated on 18-Oct-2022 11:44:19

2K+ Views

A Pong game is a two-player paddle game where each player’s task is to save the ball from hitting the wall. Whenever player 1 hits the ball at the opponent’s wall then player one will receive a point, and similarly, player 2 will get a point if he/she hits the ... Read More

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

Prince Varshney

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 ... Read More

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

Prince Varshney

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 ... Read More

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

Prince Varshney

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, ... Read More

How to print colored text in the console using JavaScript?

Prince Varshney

Prince Varshney

Updated on 21-Jul-2022 13:24:02

2K+ Views

In this article, we will learn how to add colors to the text and print them in the console window of JavaScript. In the original, all the data printed in the console is of black color no other color is reflected in the console but here we are going to ... Read More

How to check if the constructor of an object is a JavaScript Object?

Prince Varshney

Prince Varshney

Updated on 21-Jul-2022 13:22:35

803 Views

In this article, we will check whether the constructor of an object is a JavaScript Object. The constructor property of any JavaScript variable returns a reference to the Object constructor function that created the instance object. The value of this property is a reference to the function itself.All the objects ... Read More

How to display a message when a given number is in the range using JavaScript?

Prince Varshney

Prince Varshney

Updated on 21-Jul-2022 12:54:56

635 Views

In this article, we will check whether a number lies between a range or not and display a message according to the output we get. This feature of JavaScript allows you to put a number validation while creating a form or any other document.SyntaxFollowing is the syntax to check if ... Read More

How to create dynamic values and objects in JavaScript?

Prince Varshney

Prince Varshney

Updated on 21-Jul-2022 12:48:46

8K+ Views

Dynamic values are the values we assign to the dynamic variables. A dynamic variable is a type of variable that doesn't have any specific name in the code through hard coded, its address is determined when the code is running. The name dynamic refers to the value which is capable ... Read More

How to convert a value to a safe integer using JavaScript?

Prince Varshney

Prince Varshney

Updated on 21-Jul-2022 12:46:49

382 Views

An integer is known to be a safe integer if that can be exactly represented as an IEEE-754 double precision number. A safe integer is an integer in the range -(2^53 - 1) to (2^53 - 1). All these numbers are considered safe integer because it allows the one-to-one mapping of ... Read More

Advertisements