Shubham Vora

Shubham Vora

793 Articles Published

Articles by Shubham Vora

Page 78 of 80

How do I print Unicode characters in the console using JavaScript?

Shubham Vora
Shubham Vora
Updated on 22-Jul-2022 4K+ Views

In this article, we will learn how to print Unicode characters in the console using JavaScript. No matter the platform, the software, or the language, Unicode assigns a unique number to each character.Most writing systems' characters are defined by the universal character set known as Unicode, which also assigns each character a unique number (code point). A unit of data called an abstract character (or character) is used to organize, manage, or represent textual data.Most of the modern languages' letters, punctuation marks, diacritical markings, mathematical symbols, technical symbols, arrows, emoji, and other symbols are all included in Unicode.These are different ...

Read More

How do I display image in alert/confirm box in JavaScript?

Shubham Vora
Shubham Vora
Updated on 22-Jul-2022 5K+ Views

In this tutorial, we will learn to display the image in the alert or confirm box in JavaScript. The alert() is the JavaScript method that displays the alert or confirms box on the top center of the screen when you invoke it.As a programmer and user, you have seen on many websites that they ask you for confirmation in the dialog box before you delete any precious thing in your user's account. Also, the alert box can be helpful to show some information when a user comes into the web page or a message.So, the default alert box can have only ...

Read More

How do I declare a namespace in JavaScript?

Shubham Vora
Shubham Vora
Updated on 22-Jul-2022 6K+ Views

A namespace is a programming concept that gives identifiers (names of types, functions, variables, etc.) scope to avoid name conflicts. For instance, a program may need to use the same variable name in many contexts. In such a case, namespaces will separate these contexts so that the same identifier may be utilized in many namespaces.The initialization and application of namespaces in JavaScript will be covered in this tutorial. A namespace is not by default available in JavaScript. Constructing a global object that contains all functions and variables, the JavaScript Namespace feature may be repeated. Because numerous libraries and components are ...

Read More

How do we use throw statement in JavaScript?

Shubham Vora
Shubham Vora
Updated on 20-Jul-2022 778 Views

In this tutorial, we will learn to use the throw statement in JavaScript. The “throw” is the reserved keyword in JavaScript, and Programmers can use the throw keyword to create the user-defined exception.Every programmer is not perfect, so they can’t write the JavaScript code without making a single error. It also happens that programmers are taking the input from the user, and an exception occurs if the user enters the invalid input. Some built-in exceptions include arithmetic exceptions, Index out-of-bound exceptions, etc. In some cases, programmers want to create their exception and can do it using the throw statement inside ...

Read More

How do I subtract minutes from a date in JavaScript?

Shubham Vora
Shubham Vora
Updated on 20-Jul-2022 6K+ Views

In this tutorial, we will learn to subtract minutes from the date in JavaScript. While developing the applications, programmers need to play with the dates many times. All JavaScript programmers are lucky enough that JavaScript contains the built-in date class with hundreds of different methods.In this tutorial, we will learn to subtract the minutes from the date in vanilla JavaScript using the date object and the Moment JS library.Using the getMinutes() and setMinutes() MethodsIn this approach, we will create a new date object and extract the minutes from that using the getMinutes() method.After that, we will update the minutes by ...

Read More

How do I replace a character at a particular index in JavaScript?

Shubham Vora
Shubham Vora
Updated on 20-Jul-2022 2K+ Views

It is often required to update the string and replace the single character at a particular index while programming with JavaScript. JavaScript doesn’t contain the built-in method to replace the single character at the particular index in the string as the Java and C++, but we can use some other built-in methods and create custom logic to solve our problem.In this tutorial, we have two methods to replace the character at a particular index in the string and update the string. One is by converting string to array, and another is using the substr() built-in method of JavaScript.Replace Character by ...

Read More

How do I empty an array in JavaScript?

Shubham Vora
Shubham Vora
Updated on 20-Jul-2022 600 Views

This tutorial teaches us to make an array empty in JavaScript. While programming with JavaScript, programmers need to make an array empty in many conditions. For example, coders are doing competitive programming with JavaScript. Suppose, to solve some problem, they need to create a new or an empty array while calling the function every time. Users can visualize this problem from the below example.function child ( ){    // create a new array or use a single array and make it empty every time function invokes    }    function parent ( ) {       for ( int ...

Read More

How do I convert a float number to a whole number in JavaScript?

Shubham Vora
Shubham Vora
Updated on 20-Jul-2022 6K+ Views

In this tutorial, we will learn to convert a float number to a whole number in JavaScript. The whole number is the number that doesn’t contain the fractional part. For example, 5.22 is the float number containing the fractional part, and the whole number doesn’t contain a decimal part. So, our goal in this tutorial is to remove the fractional part from the number.We can have various methods to cut out the decimal part from the float number to make it whole, and some of them we have discussed here.Using the Math.trunc() and Math.round() MethodsUsing the parseInt() MethodUsing the Bitwise ...

Read More

How do I compare String and Boolean in JavaScript?

Shubham Vora
Shubham Vora
Updated on 20-Jul-2022 5K+ Views

In this tutorial, we will learn to compare a string to the Boolean in JavaScript. The JavaScript has an equality operator to compare one value with another value.There are two types of equality operators in JavaScript; one is an equality operator (==), and another is a strict equality operator (===). The difference between both of them is they compare operands differently.The equality operator compares the only values of both operands and returns the Boolean value.The strict equality operators first compare the values of both operands, and if the values match, it compares the data type of both operands. In such ...

Read More

How can I escape HTML special chars in JavaScript?

Shubham Vora
Shubham Vora
Updated on 14-Jul-2022 10K+ Views

HTML contains special characters such as ‘, ’ ‘/, ’ and many more such as single and double commas. These special characters are used for the HTML tag, such as ‘’ is used to close the HTML tag. This tutorial teaches us to escape HTML special characters in JavaScript.Now, the question is that what if we want to use these characters inside the HTML content? If we use special characters normally in the HTML content, it considers it the opening or closing HTML tag and produces an unknown error.For example, we need to render the below string to the browser. ...

Read More
Showing 771–780 of 793 articles
Advertisements