Optimize your JavaScript code using modern techniques, tips, and tricks

  • Sort an array of objects by string property value
  • How to Round to at most 2 decimal places (only if necessary)
  • How do I loop through or enumerate a JavaScript Object?
  • What is the difference between event.preventDefault() and return false
  • How can I check for an empty/undefined/null string in JavaScript?
  • How to insert an item into an array at a specific index (JavaScript)?
  • How to Get the current URL with JavaScript?
  • Checking if a key exists in a JavaScript object?
  • How to merge two arrays in JavaScript and remove duplicate items?
  • How to check whether a string contains a substring in JavaScript?
  • How to replace all occurrences of a string?
  • How to correctly clone a JavaScript object?
  • What is the !! (not not) an operator in JavaScript?
  • How to Loop through an array in JavaScript
  • How do I copy to the clipboard in JavaScript?
  • How do I test for an empty JavaScript object?
  • How do I make the first letter of a string uppercase in JavaScript?
  • How can I change an element’s class with JavaScript?
  • Is it possible to apply CSS to half of a character?
  • How to append something to an array?
  • How to check if an object is an array?
  • How to detect an undefined object property?
  • How can I convert a string to a boolean in JavaScript?
  • How can I get query string values in JavaScript?
  • How to get the length of a JavaScript object?
  • How to reverse a string that contains complicated emojis?
  • How can I convert a string to an array of objects in JavaScript?
  • How to detect if the user changes tab in JavaScript?
  • How to sum a property value from an array of objects?
  • How to Format JavaScript date?
  • How to Generate random string/characters in JavaScript?
  • How to execute API calls after entering 3 characters in the field?
  • How to rename object keys inside an array?
  • How do you clear the focus in javascript?
  • Binary to String in JavaScript
  • Shift strings Circular left and right in JavaScript
  • Regular expression to check for IP addresses JavaScript
  • How to JSON stringify a JavaScript Date and preserve timezone
  • JavaScript to check if a string is a valid number
  • Export a JSON Object to a text file
  • Wrap long template literal line to multiline without creating a new line in the string
  • How to copy text from a div to clipboard

#javascript #typescript #angular #node #react

42 Tips and Tricks to Write Faster, Better-Optimized JavaScript Code

medium.com

42 Tips and Tricks to Write Faster, Better-Optimized JavaScript Code

Optimize your JavaScript code using modern techniques, tips, and tricks: Sort an array of objects by string property value; How to Round to at most 2 decimal places (only if necessary); How do I loop through or enumerate a JavaScript Object? What is the difference between event.preventDefault() and return false; How can I check for an empty/undefined/null string in JavaScript? How to insert an item into an array at a specific index (JavaScript)? How to Get the current URL with JavaScript? Checking if a key exists in a JavaScript object? How to merge two arrays in JavaScript and remove duplicate items? How to check whether a string contains a substring in JavaScript? How to replace all occurrences of a string? How to correctly clone a JavaScript object? What is the !! (not not) an operator in JavaScript? How to Loop through an array in JavaScript? How do I copy to the clipboard in JavaScript? How do I test for an empty JavaScript object? How do I make the first letter of a string uppercase in JavaScript? How can I change an element’s class with JavaScript? Is it possible to apply CSS to half of a character? How to append something to an array? How to check if an object is an array? How to detect an undefined object property? How can I convert a string to a boolean in JavaScript? How can I get query string values in JavaScript? How to get the length of a JavaScript object? How to reverse a string that contains complicated emojis? How can I convert a string to an array of objects in JavaScript? How to detect if the user changes tab in JavaScript? How to sum a property value from an array of objects? How to Format JavaScript date? How to Generate random string/characters in JavaScript? How to execute API calls after entering 3 characters in the field? How to rename object keys inside an array? How do you clear the focus in javascript? Binary to String in JavaScript; Shift strings Circular left and right in JavaScript; Regular expression to check for IP addresses JavaScript; How to JSON stringify a JavaScript Date and preserve timezone? JavaScript to check if a string is a valid number; Export a JSON Object to a text file; Wrap long template literal line to multiline without creating a new line in the string; How to copy text from a div to clipboard

3.15 GEEK