Javascript function defining -


i got script debugging , have no idea following section means.

var qns = () => site + status + "\ " let status = "true"; 

the variable status has not defined before.

this javascript 1.7, available on firefox, not on other browsers.

var qns = () => site + status + "\ " 

is equivalent, shorter than:

var qns = function() {   return site + status + "\n"; } 

(not sure if newline valid or not). arrow functions on mdn

let status = true same var status = true aside scope: declared containing block. 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 way, variable status not need declared before line; enough if declared before qns() invoked later. let statement on mdn


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -