'_'

JavaScript_p5.js_array 본문

자료용/HTML_CSS_JAVASCRIPT

JavaScript_p5.js_array

YISUP 2018. 2. 2. 10:57

5.4: Functions Inside of Objects - p5.js Tutorial


in javaScript, Object{ name: value }  pair!!!!!!!!! 

basically, adding functions and properties to Objects in javascript looks like this:


var object = {

    myvar : "12",

    mymethod : function(test) {

 return something; } 

}


then call mymethod like:


object.mymethod(parameter);


or the deeper version :


var object = {

    object2 : {

       mymethod : function(test) { return something; }

    }


then:


object.object2.mymethod(parameter);


parameters/arguments:

Unlike argument in usual mathematical usage, the argument in computer science is thus the actual input expression passed/supplied to a function, procedure, or routine in the invokation/call statement, whereas the parameter is the variable inside the implementation of the subroutine. For example, if one defines the add subroutine as def add(x, y): return x + y, then x, y are parameters, while if this is called as add(2, 3), then 2, 3 are the arguments. Note that variables (and expressions thereof) from the calling context can be arguments: if the subroutine is called as a = 2; b = 3; add(a, b) then the variables a, b are the arguments, not the values 2, 3. See the Parameters and arguments section for more information.


array in javascript

array in javascript tries to assume and figure out how long or how many elements are in array, therefore daniel shiftman is saying, declare array at the global level and create an object definition into setup function, assign it to array.






'자료용 > HTML_CSS_JAVASCRIPT' 카테고리의 다른 글

clean up JS + PI wall + RaspberryPI  (0) 2018.10.30
font family  (0) 2018.10.27
image responding to window size  (0) 2018.05.13
api_p5.js  (0) 2018.02.03