AmitDiwan has Published 10740 Articles

How to sort strings with accented characters using JavaScript?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:52:50

434 Views

Following is the code to sort strings with accented characters in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result, .sample {       font-size: 18px;       font-weight: 500;   ... Read More

TypeError: ‘undefined’ is not an object in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:50:46

2K+ Views

The “TypeError: ‘undefined’ is not an object” error occurs when a property is accessed or a method is called on an undefined object. This error is shown only on safari browser.Following is the code for TypeError − ‘undefined’ is not an object error in JavaScript −Example Live Demo ... Read More

How to convert a node list to an array in JavaScript?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:47:29

385 Views

Following is the code to convert a node list to an array in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       display: inline-block;       font-size: 20px; ... Read More

Can we check if a property is in an object with JavaScript?

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:46:18

136 Views

Following is the code to check if a property is in an object in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: ... Read More

Pseudo mandatory parameters in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:43:22

180 Views

Following is the code to implement pseudo mandatory parameters in functions in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: 500;   ... Read More

Fat vs concise arrow functions in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:41:22

271 Views

The consice arrow is more stream lined form of fat arrow functions for one-line functions. If the function body only has one line of code, then there isn’t any need of curly braces {} for function body as conscie arrow functions have implicit return. Also, if there is only one ... Read More

Concise arrow functions in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:39:29

477 Views

The conscise arrow function syntax is as follows −(param1, param2) =>param1+param2It doesn’t have the function keyword and the function body. There is only => between the parameters and function body and if there is single parameter than it can also be written like this −param1=>param1*2It has implicit return if there ... Read More

Fat arrow functions in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:37:31

348 Views

The fat arrow function syntax looks like the following −(param1, param2, ..)=>{ }It doesn’t have the function keyword and only have the => between the parameters and the function body.Following is the code implementing fat arrow functions in JavaScript −Example Live Demo Document    body { ... Read More

Passing parameters to callback functions JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:35:38

493 Views

Following is the code for passing parameters to callback functions in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result{       font-size: 20px;       font-weight: 500;       ... Read More

No. of ways to empty an array in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Jul-2020 11:33:16

228 Views

To empty an array in JavaScript, there are four ways −Setting to new Array − In this we set our array variable to a new empty array.Using length property − In this we set the length property of our array to 0.Using pop − In this we continuously pop the ... Read More

Advertisements