Short Hand Techniques for Javascript Developers
5. Multiple OR Conditions:
You could use an array instead for multiple OR conditions. I there are only a few possibilities, use the long-hand one. But if there are more may be 10, use Array.indexOf()
Short Hand Techniques for Javascript Developers 4. Object Property Short Hand: Defining object literals in JavaScript makes life much easier. ES6 provides an even easier way of assigning properties to objects. If the variable name is the same as the object key, you can take advan...
See more
Short Hand Techniques for Javascript Developers
3. Short-Circuit Evaluation:
Instead of writing six lines of code to assign a default value if the intended parameter is null or undefined, we can simply use a short-circuit logical operator and accomplish the same thing with...
See more
Short Hand Techniques for Javascript Developers 2. Declaring variables ShortHand: It’s good practice to declare your variable assignments at the beginning of your functions. This shorthand method can save you lots of time and space when declaring multiple variables at the same time.
Short Hand Techniques for Javascript Developers
1. The Ternary Operator:
This is a great code saver when you want to write an if..else statement in just one line.
Hello guys,
Hope you are all safe during this pandemic. Thank you so much for following 'Web Camp.'We will be posting new articles soon.
One important information for you all....We have created a new page : Web QuestionBank. From now onwards, All the questions will b...
See more
'instanceof ' keyword was introduced in which version of PHP?
Which method scope prevents a method from being overridden by a subclass in PHP?
What will be the output?<?php
$num = 24;
while($num < 12){
$num += 4;
echo $num;
}
?>
foreach loop is used to iterate over ____?
In database, A_____ is a query that retrieves rows from more than one table or view
Which one is correct syntax for applying UNION operator?