I am working on a project using Easel JS. Opened the Easel file, and the first line of code confused me:
this.createjs = this.createjs||{};
I know that createjs is called when you customize your canvas or, for example, create a bitmap to add to the canvas. But I do not understand the syntax of this line - assign this.createjs or (what I think) an empty this.createjs object?
If this.createjsunavailable / value falsy, then you assign {}an empty object this.createjs.
this.createjs
falsy
{}
It looks more like
var a, b; b = a || 5;
Since it adoes not matter at present, it 5will be assigned b.
a
5
b
. , this.createjs , . || - a - this.createjs falsy, .
||
If this.createjs is false, this.createjs will be the new empty object
You could replace it with
if (!this.createjs){ this.createjs = {}; }
||means or. In this context, means this.createjsequal if there is / not null / defined in this.createjsanother way{}
or