This question already has answers here:
Learning Regular Expressions [closed]
(1 answer)
Reference - What does this regex mean?
(1 answer)
Javascript Regex: How to put a variable inside a regular expression? [duplicate]
(9 answers)
Closed 4 years ago.
Is there any difference between the two regexes?
isFunctionKey(funKey) {
return /^('funKey')|([01][1-9]|2[0-4])$/.test(funKey);
}
and
isFunctionKey(funKey) {
return /^(funKey)|([01][1-9]|2[0-4])$/.test(funKey);
}
HINT: Look into return statement funkey; one is in quotes and the other is not.
Related
This question already has answers here:
Null-safe property access (and conditional assignment) in ES6/2015
(11 answers)
What is the obj?.prop syntax in javascript? [duplicate]
(3 answers)
Closed 2 years ago.
I do know the ternary operator
but using '?' without colon that's unusual to me
Here is an example:
path?.forEach(id => checkID(id));
This question already has answers here:
Regular expression to extract text between square brackets
(15 answers)
Getting content between curly braces in JavaScript with regex
(5 answers)
Closed 3 years ago.
How to loop and get all string starts with { and ends with } into an array? For example:
Hi {recipient}, calling from {sender}. Your {item} has arrived.
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.
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([[[!![]+[]]+[]]+[]][+[]][+[]]);
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.