How to create a multiline string in JavaScript
The easiest way to create a multiline string in JavaScript are backticks. const s = `I'm a multiline string`; console.log(s); The console output shows every word in the string s on a new line....
The easiest way to create a multiline string in JavaScript are backticks. const s = `I'm a multiline string`; console.log(s); The console output shows every word in the string s on a new line....
As obvious and easy as it may sound, converting string values of "true" and "false" to booleans can be tricky. There are many ways to shoot our own foot, if you don鈥檛 know how JavaScript works under the hood....
In JavaScript there are 2 distinct scenarios when the object property can be undefined. Let鈥檚 look into them and find out how to check for undefined fields in JS objects. ...
If you try to apply the typeof operator to a JavaScript array, you won鈥檛 be able to tell if it鈥檚 an array. To check if a variable is an array in JS, you need to take a different approach. ...
There are 2 ways to get the current URL from a browser using JavaScript. The main one is window.location.href and document.URL is an alternative option. ...
Double negation is a common JavaScript trick that allow you to convert different types to boolean. Here鈥檚 how double negation works in JS. ...
There are 3 main ways you can copy something to clipboard with JavaScript. The main one is the Async Clipboard API. It reads the text from DOM and places it on the clipboard. ...
Every date in JS can be represented as a number of milliseconds since Jan 1, 1970. Here鈥檚 how you can get the timestamp value from any JavaScript date. ...
In JavaScript, the best way to reliably verify that a string is a valid email is by using a regular expression. Here鈥檚 how it鈥檚 done. ...
Learn how you can implement fast deep cloning of objects in JavaScript. ...