I did C( and a bit of C++)programming all my life till now and started to learn Javascript recently.
I am having tough time to understand some of the Javascript Syntax.
Can someone explain me the following line :
window.$N = $N || {};
Thanks!
I did C( and a bit of C++)programming all my life till now and started to learn Javascript recently.
I am having tough time to understand some of the Javascript Syntax.
Can someone explain me the following line :
window.$N = $N || {};
Thanks!
In browsers, the window
object is global.
If $N
is falsy, {}
will be assigned to window.$N
. If $N
is truthy, its value will be assigned to window.$N
(keeping the same value probably).
This is a common way to override default values.