1

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.

2

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.