Sravani Alamanda has Published 28 Articles

How to catch syntax errors in JavaScript?

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 10:30:13

1K+ Views

In this tutorial, we will learn how to catch syntax errors in JavaScript. In JavaScript, we get will errors if we write any mistakes in code. Like, ReferenceError, i.e., when we call a variable that does not exist in our code. TypeError i.e. when we tried to change ... Read More

Find the non-digit character with JavaScript Regular Expression

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 10:26:56

1K+ Views

In this tutorial, we will learn to find the non-digit character with JavaScript regular expression. ASCII code 'A' is 65 and 'a' is 97 etc. Now, we will check how to find a nondigit element (\D) in a given text using RegExp. RegExp is an object that specifies the ... Read More

How to catch any JavaScript exception in Clojurescript?

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 10:23:09

140 Views

In our code, usually, we will get an issue with errors. Errors will disturb the normal flow of our application. So, it is required to handle error exceptions in our code to implement any application in any programming language. Now, we will see how to handle exceptions in Clojurescript. Before ... Read More

Find non-word character in a string with JavaScript RegExp

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 10:06:31

1K+ Views

In this tutorial, we learn how to find non-word characters in a string using JavaScript Regular Expression. Actually, word characters include A-Z, a-z, 0-9 and _. Coming to the non-word characters except word characters like !, @, #, $, %, ^, &, *, (, ), {, } etc. Non-word characters, ... Read More

Calculate text width with JavaScript

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 10:04:58

6K+ Views

To calculate text width, we can use the measureText() method in JavaScript. In canvas, the measureText() method is used to measure width of the text content. This means we can pass text to this canvas method and then call that method to measure the text. It will return an object ... Read More

How -Infinity is converted to String in JavaScript?

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 09:47:04

119 Views

We all know that string is one of the primitive data types in JavaScript. JavaScript allows us to do some operations on strings like finding characters in the string, changing all characters into lowercase or into uppercase, concatenating with other strings, replacing with other strings, searching character(s) or word(s) from ... Read More

How can I reimplement JavaScript delete method?

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 09:38:12

212 Views

The delete operator in JavaScript is used to remove properties from an object to remove element(s) from an array or to remove element(s) from a set object. Always remember the following points about delete: delete is a keyword in JavaScript, so it shouldn’t be altered, and you cannot use delete ... Read More

How can I get days since epoch in JavaScript?

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 09:30:29

3K+ Views

In this tutorial, we are going to learn about how to calculate days from epoch using JavaScript. Here, we are going to use the Math.abs() and the Math.floor() methods to calculate days. First, we are going to learn about what an epoch is. What is Epoch? It is also ... Read More

Find word character in a string with JavaScript RegExp?

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 09:28:45

839 Views

In this tutorial, we will see how to find a word character from the text. Word character denote as \w. Word character is a character like a-z, A-Z and 0-9 and also includes underscore(_). We all know about RegExp (Regular Expression) in js. RegExp is an object and specifies the ... Read More

Can I use a JavaScript variable before it is declared?

Sravani Alamanda

Sravani Alamanda

Updated on 08-Dec-2022 09:26:07

2K+ Views

Yes, you can use a JavaScript variable before it is declared, with a technique called hoisting. The parser reads through the complete function before running it. The behavior in which a variable appears to be used before it's declared is known as hoisting. For example, the following, rank = ... Read More

Advertisements