How to use JavaScript forEach()

arrA.forEach( callbackFucntionB[, thisArgC ] )

  • callbackFucntionB
    • Parameters
      • value // current process value
      • index // current process index
      • array // arrA
  • thisArgC
    • ‘this’ in callbackFucntionB

 

Example

[2, 5, 9].forEach(function( v, i, arr ) {
console.log( v, i, arr );
});

 

Links

//

Professional WebGL Programming Ch 0 – Index and Introduce

Professional WebGL Programming Ch 0 – Index and Introduce

Ch.1
– WebGL Background knowledge
– Other Graphics Technologies
– Graphic Pipeline
– Graphic Hardware
– Basic Linear Algebra for 3D Graphics and WebGL

Ch.2 Practice knowledge
– WebGL Application
– Vertex Shader and Fragment Shader
– Tools and Debugging
– Problem resolving

Ch.3 Drawing
– Options
– Methods
– Primitives

Ch.4 Background knowledge for 3D Graphics
– JavaScript Library for Vector and Matrix Operations
– Object direction and position in 3D World

Ch.5
– Texturing
– Context Lost

Ch.6
– Animation in WebGL Scene
– Event Handling
– Key & Mouse Input in WebGL Scene

Ch.7 Lighting
– Lighting Model
– Implement Lighting Model using Vertex Shader and Fragment Shader

Ch.8 Performance Optimization
– Guide line, tips and tricks
– FPS
– Bottleneck
– Mobile tech.
– Hardware and Software

//

Backup wordpress xml to each text file ( customizing wxr2txt.py )

Backup wordpress xml to each text file ( customizing wxr2txt.py )

– Support utf-8
– Make category folder
>> It makes duplicated file
>> That’s because WordPress allows posts to have multiple categories.

Original : https://gist.github.com/ruslanosipov/b748a138389db2cda1e8
//

Javascript check css animation complete callback

CSS aniamation complete check callback event

var transitions = {
‘transition’:’transitionend’,
‘OTransition’:’oTransitionEnd’,
‘MozTransition’:’transitionend’,
‘WebkitTransition’:’webkitTransitionEnd’
}

https://davidwalsh.name/css-animation-callback

JavasScript forEach using Array initialize

# forEach loop using array

// All borwser support
ㅇ Array.apply(null, Array(10))
Array.apply(null, Array(6)).forEach((_,i) => { console.log(i) });

ㅇ using string
new Array(10).join().split(“,”).forEach((_,i) => { console.log(i) });
new Array(10).toString().split(“,”).forEach((_,i) => { console.log(i) });

// Not working on IE
ㅇ fill method
Array(length).fill(default value);
Array(4).fill(1);
// https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/fill

# initialize javascript array with initial value
var a = Array.apply(null, Array(24)).map(function() { return 0 });
var a = function _re(n){if(n > 0) return _re(n-1).concat(n); return [0];}(10);