properties - What does this line of javascript mean? -
I hope to learn some things in retina.js Opened, but I've been stumped on the first line.
var root = (typeof export === 'undefined'? Window: export);
What does this line actually do?
forward down,
function retina () {} root.Retina = Retina;
How was the retinal property established without root before it was defined?
typeof
is the operator, which is used on a variable, Which is not defined at all, will still give the result in the value 'undefined' . Expression:
(typeof export === 'undefined'? Window: export)
Checks whether export window
(global object in the browser), and if this happens, then the result of export
(exporting) A standard name for things [type] from module - see) As a result, the route
is assigned.
If you were thinking about conditional operators,
var d = a? B: C;
is equal to or equal to var d; If (A) {D = B; } And {d = c; }
As root.Retina = Retina; For JavaScript, like all other properties in JavaScript, there is no need to declare it and there is no facility to declare it.
Comments
Post a Comment