Vineeth.mariserla has Published 278 Answers

Regular functions vs Arrow functions in JavaScript?

vineeth.mariserla
Published on 26-Aug-2019 15:49:36
Regular functions vs Arrow functionsAn arrow function is used to write the code concisely. Both functions regular and arrow work in a similar manner but there are some differences between them. Let's discuss those differences in a nutshell.syntax of an arrow functionlet x = (params) => { // code };syntax of a ... Read More

\d vs \D in JavaScript?

vineeth.mariserla
Published on 26-Aug-2019 13:55:26
\d vs \DThere is a lot of difference between \d and \D in which the former results in the digits and the latter results in the non-digits such as e, ^, etc. These are used along with global object "g" so that all the digits and non-digits across a text ... Read More

\w vs \W in JavaScript regex?

vineeth.mariserla
Published on 26-Aug-2019 13:08:18
\w vs \WThere is a lot of variation between '\w' and '\W' in javascript in which the former looks after 'word characters' such as alpha-numerics whereas the latter looks after 'non-word characters' such as &, ^, %, etc. Let's discuss it in a nutshell.syntax-1new RegExp("\\w", "g");The above code gives out the syntax ... Read More

Why is using “for…in” loop in JavaScript array iteration a bad idea?

vineeth.mariserla
Published on 26-Aug-2019 12:05:31
In most of the cases, it is better to use normally a 'for' loop rather than "for...in" loop because the "for...in" loop results in the indexes and won't bother about the leftover indexes whereas the normal "for" loop displays the values and in the leftover indexes a value called  'undefined' will ... Read More

How to access a JavaScript object using its own prototype?

vineeth.mariserla
Published on 26-Aug-2019 08:52:59
We can able to access the existing object by creating its own prototype using a javascript method called "Object.create()". Using this method we can inherit the properties from the existing properties to the newly created prototype. Let's discuss it in a nutshell.syntaxObject.create(existing obj);This method takes the existing object and creates ... Read More

How to convert a string into integer in JavaScript?

vineeth.mariserla
Published on 23-Aug-2019 15:46:00
To convert a string to an integer parseInt() function is used in javascript. parseInt() function returns Nan( not a number) when the string doesn’t contain number. If a string with a number is sent then only that number will be returned as the output. This function won't accept spaces. If any particular number with ... Read More

JavaScript's Boolean function?

vineeth.mariserla
Published on 23-Aug-2019 15:17:10
Boolean functionWhile developing, a developer may come across yes/no situation. At that point of time Boolean() function can be used. It results only in true or false. Let's discuss it in detail.syntaxBoolean(exp);It takes an expression and scrutinizes it and displays either true or false based on the validity of the ... Read More

How to generate a random number in JavaScript?

vineeth.mariserla
Published on 23-Aug-2019 14:30:35
Generating a random  numberTo generate a random number,  Math.random() is used. We can even generate a number between specified numbers such as between 1 and 10, between 0 and 100, etc. Let's discuss it using an example.syntaxMath.random();ExampleIn the following example, using Math.random() function inside a Math.floor() function, which results in integer values, ... Read More

Super keyword in JavaScript?

vineeth.mariserla
Published on 23-Aug-2019 13:38:52
SuperThe super keyword is used to access and call functions on an object's parent. The super.prop and super[expr] expressions are legible in any method definition in both classes and object literals. It is used in the "extended" class, which uses "extends" keyword.syntaxsuper(arguments);ExampleIn the following example, the characteristics of a class called ... Read More

JavaScript Sleep() function?

vineeth.mariserla
Published on 23-Aug-2019 11:53:56
Sleep()With the help of Sleep() we can make a function to pause execution for a fixed amount of time. In programming languages such as C and Php we would call sleep(sec). Java has thread.sleep(), python has time.sleep() and GO has time.Sleep(2 * time.Second).javascript doesn't have these kinds of sleep functions. But we should thank promises and ... Read More
1 2 3 4 5 6 7 ... 28 Next
Advertisements