0:00
Are you new to javascript? I'm sharing with you top 10 amazing tricks that will blow your mind
0:06
Execution time. You can measure the execution time of a code by using console.time and console.time
0:14
end. All you have to do is to put your code inside them, pass an equal label to them
0:19
and there you go. Just run the code. Array to object. How do you convert an array to an object? Well
0:29
you could do that just by using a spread operator. Filling an array. Well, if you want to have an array filled with similar values
0:40
you can use fill method to achieve that. Object to table. If you have a giant array containing tons of objects
0:47
you can use console.table to represent them in clean table or form
0:53
Grouping. You can group different items using console.group and console.group end. This helps in debugging your code. Console colors. You could change the
1:04
color of the text shown using console.log. Again, this plays a huge role in debugging purposes
1:11
Shorten if-else statement. If you're dealing with if-else statements, you should consider ternary operator. Now these both codes will result in same output
1:20
while the latter one will save around 5 lines of code. Large numbers. If you're dealing with large numbers
1:28
you can try adding underscores as a separator to increase the readability
1:37
Arrow functions. Arrow functions allow you to code cleaner and saves unnecessary lines of code
1:44
Equality. Do you know the difference between double equal and triple equal? While the latter
1:50
one checks for the data type of the given value as well, it's recommended to use triple equal
1:55
symbol than a double equal. That's all for now