Reputation: 13
I just got this script for debugging and have no idea what this following section means.
var qns = () => site + status + "\
"
let status = "true";
The variable status has not defined before.
Upvotes: 1
Views: 59
Reputation: 198408
This is JavaScript 1.7, available currently on Firefox, but not on most other browsers.
var qns = () => site + status + "\
"
is equivalent, but shorter than:
var qns = function() {
return site + status + "\n";
}
(not sure if newline is valid or not). Arrow functions on MDN
let status = true
is same as var status = true
aside from the scope: it will only be declared for the containing block. For example,
if (true) {
var x = 1;
let y = 2;
console.log(x); // => 1
console.log(y); // => 2
}
console.log(x); // => 1
console.log(y); // => undefined
By the way, the variable status
does not need to be declared before your line; it is enough if it is declared before qns()
is invoked later. let
statement on MDN
Upvotes: 4