RcBuilder@walla.com
call centre: 054-5614020

javascript callback fucntion

Posted by: RcBuilder  /   Category: Array / callback / class / function / JAVASCRIPT / Object / OOP   /   No Comments
26
Jan
2016

javascript callback fucntion function foreach(arr, callback) { for (var i = 0; i < arr.length; i++) callback.call(this, arr); } var arr = ; foreach(arr, function (item) { console.log(item); }); --- function fun1(callback) { setTimeout(callback, 2000); } console.log('hey there ... '); fun1(function () { console.log('hello from callback'); }); console.log('hello again ... '); /* hey there ... hello again ... hello from callback */ --- function fun2(callback) { var user = { id: 25, Name: 'Roby Cohen', Age:.

Read more

javascript apply and call

Posted by: RcBuilder  /   Category: Array / class / function / JAVASCRIPT / Object   /   No Comments
26
Jan
2016

javascript apply and call apply allows to call any function on any object, parameters as array, the caller object will serve as the context and we can reach it using the 'this' variable. syntax: .apply(, ); e.g: function Person(name) { this.name = name; } function doSomething(param1, param2) { // this refer to the caller object console.log(this.name + ' -> ' + param1 + ', ' + param2); } var person1.

Read more

javascript arguments

Posted by: RcBuilder  /   Category: Array / class / function / JAVASCRIPT / Object   /   No Comments
26
Jan
2016

javascript arguments The arguments object is an Array-like object, it's a local variable available within all functions. the arguments object is only similar to an array but not a real one and it doesn't include any of the array functions except of length() we can pass any parameters we'd like and it automatically pass them as an arguments.

Read more

javascript object properties access using []

Posted by: RcBuilder  /   Category: Array / class / function / JAVASCRIPT / Object / OOP   /   No Comments
26
Jan
2016

javascript object properties access using syntax var dictionary = {}; dictionary = 'AAA'; dictionary = 'BBB'; dictionary = 'CCC'; console.log(dictionary); // BBB console.log(dictionary.B); // BBB note! in the example above, we created an object with 3 properties A,B and.

Read more

javascript arrays

Posted by: RcBuilder  /   Category: Array / JAVASCRIPT / OOP   /   No Comments
26
Jan
2016

javascript arrays structure: - var arr = ; data types: arrays can hold any type of objects, not necessarily the same for all organs they can be consisted of mixed types (string, int, function, custom objects etc.) example: var arr = ; console.log(arr); // hello world console.log(arr); // 23 console.log(arr); // 400.31 var fun = arr; fun('Roby'); // this will log 'hello again Roby' to the console arr();.

Read more

javascript advanced arrays

Posted by: RcBuilder  /   Category: Array / class / function / JAVASCRIPT / Object / OOP   /   No Comments
26
Jan
2016

javascript advanced arrays we can define data members, public properties, private and public methods, arrays, matrixes, custom objects ... var MyObject = { prop1: 'some string value', prop2: 40, prop3: 300.23, prop4: , prop5: { x: 40, y: 50, z: 70 }, prop6: new Array(), fun1: function () { console.log(this.prop1); }, fun2: function (index) { console.log(this.prop4); }, fun3: function () { console.log(this.prop5.z); }, fun4: function (item) { this.prop6.push(item); console.log(this.prop6.length); } }; console.log(MyObject.prop1); // some string value console.log(MyObject.prop2); // 40 MyObject.fun1();.

Read more

javascript Array Name index

Posted by: RcBuilder  /   Category: Array / JAVASCRIPT   /   No Comments
08
Jan
2015

javascript Array Name index example 1 var mat = new Array(); mat = ; mat = ; alert(mat); // Avi alert(mat); // Ronit example 2 var arr = new Array(); arr = 'Roby'; arr = 'Ron'; arr = 'Avi'; arr = 'Yossi'; arr = 'Ronit'; arr = 'Galit'; alert(arr); notice! this technique is not created an actual array by an object with properties so all the methods of array will not work.

Read more

javascript foreach implementation

Posted by: RcBuilder  /   Category: Array / callback / JAVASCRIPT   /   No Comments
09
Nov
2014

javascript foreach implementation function forEach(list,callback) { for (var n = 0; n < list.length; n++) { callback.call(list); } } var myArray = ; forEach( myArray, function(){ alert(this); // do.

Read more

option javascript class

Posted by: RcBuilder  /   Category: append / Array / HTML / JAVASCRIPT / jQuery / onchange / select   /   No Comments
09
Nov
2014

option javascript class OPTION CLASS function option(text, value) { this.text = text; this.value = value; this.toTag = toTag; function toTag() { return '<option value="' + this.value + '">' + this.text + '</option>'; } } HTML <select id="cmbMaster" onchange="LoadSlaveCombo(this.value);" style="width:130px;"> <option value="males">males</option> <option value="females">females</option> </select> <select id="cmbSlave" style="width:130px;"></select> USING // two levels selects // fill slave combo refer to master combo selection var arr_names = new Array(); arr_names = ; arr_names = ; function LoadSlaveCombo(type) { var cmb = $('#cmbSlave'); var arr.

Read more
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים