What does this syntax mean in Javascript? [duplicate] - javascript

This question already has answers here:
What does the comma operator do in JavaScript?
(5 answers)
What does this symbol mean in JavaScript?
(1 answer)
Using &&'s short-circuiting as an if statement?
(6 answers)
Closed 4 years ago.
I have javascript code and I found the following line :
I'm a bit confused about the syntax
e = k.attr("data-icon"), e && (a.icon = e),
I understand the first part : k.attr("data-icon") but not the rest.
Can any one tell me what does that mean please ?
cheers,

Related

Please help me to picture this in mind [duplicate]

This question already has answers here:
What does this symbol mean in JavaScript?
(1 answer)
What's the meaning of "=>" (an arrow formed from equals & greater than) in JavaScript?
(14 answers)
Closed 2 years ago.
I m trying to picture this or trying to understand this but have a question whose answers i cannot find
const csv_to_array = (data, delimiter = ',', omitFirstRow = false) =>
.slice(omitFirstRow ? data.indexOf('\n') + 1 : 0)
.split('\n')
.map(v => v.split(delimiter));//Please explain this v thing thats confusing for me
console.log(csv_to_array('a,b\nc,d'));
Please help me in this case

Why does a = (b=3,c=7) assign 7 to a in javascript? [duplicate]

This question already has answers here:
What is the point of wrapping JavaScript statements in parentheses?
(2 answers)
What does the comma operator do in JavaScript?
(5 answers)
Closed 5 years ago.
I came across an interesting thing in javascript. The following code prints 7.
a = (b=3 , c=7);
document.write(a);
I would like to know how/why this happens.

Why does [[[!![]+[]]+[]]+[]][+[]][+[]] evaluate to t? [duplicate]

This question already has answers here:
Why and how does ([![]]+[][[]])[+!+[]+[+[]]] evaluate to the letter "i"? [duplicate]
(2 answers)
What are JavaScript's builtin strings?
(7 answers)
Closed 5 years ago.
I found out that in JavaScript [[[!![]+[]]+[]]+[]][+[]][+[]] evaluate to "t". How is it possible?
I do know that !![] evaluates to true, however how to you obtain "t" from that?
console.log([[[!![]+[]]+[]]+[]][+[]][+[]]);

What is the difference between double negation and checking if the variable is truthy directly? [duplicate]

This question already has answers here:
Why use !! to coerce a variable to boolean for use in a conditional expression?
(3 answers)
What is the difference between if(!!condition) and if(condition)
(3 answers)
Why use if (!!err)?
(3 answers)
Closed 5 years ago.
I noticed my colleagues are writing code with double negation in conditions, for example:
else if(colType == 'link'){
value = !!data ? $(data).attr('href') : '';
}
In cases like this, is there a chance that the boolean result of data can be different from !!data?

Call number method with two dots in javascript? [duplicate]

This question already has answers here:
Usage of toString in JavaScript [duplicate]
(3 answers)
Why does 10..toString() work, but 10.toString() does not? [duplicate]
(3 answers)
Closed 9 years ago.
Why
123.toString()
throws an SyntaxError
while
123..toString()
is not?
The first . you type in a Number literal is the decimal point.

Categories

Resources