JavaScript Tips

JavaScript Tips Intro Banner
Post Author - Marko by Marko | April 14, 2020

In this post I will share with you JavaScript tips you won’t find in most tutorials. Enjoy!

 

What is JavaScript?

 

Javascript is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and so much more.

* Shorten an array

You can set the length property to shorten an array.

Shorten Array With Length Property

* Short-circuits conditionals

If you have to execute a function only if condition is true, you can use short-circuit.

Short Circuit Conditional Snippet

* Show specific console.table() columns

By default, `console.table()` lists all elements in each row. You can use the optional “columns” parameter to select a subset of columns to display:

Console table columns

* Remove duplicate elements from the array:

Remove duplicate elements from an array

* Convert a string to number:

Convert a string to number

* Convert a number to string

Concat Empty String.

Convert Number to String

* Remove all falsy values from an array:

FIlter Falsy Values
Did you liked this article? Share it with your friends: