How pass arguments as an Array on Function.Apply()
How pass arguments as an Array on Function.Apply()
1 var o = { x: 15 };
2
3 function f(message1, message2)
4 {
5 alert(message1 + (this.x * this.x) + message2);
6 }
7
8 function g(object, func)
9 {
10 // arguments[0] == object
11 // arguments[1] == func
Add comment August 28, 2009
How To: function.call()
How to use function.call()
1 var x = 10;
2 var o = { x: 15 };
3 function f(message)
4 {
5 alert(message);
6 alert(this.x);
7 }
8
9 f(“invoking f”);
10 f.call(o, “invoking f via call”);
Add comment August 27, 2009
How To : function.apply()
How to use function.apply()
1 var o = { x: 15 };
2 function f1(message1)
3 {
4 alert(message1 + this.x);
5 }
6
7 function f2(message1, message2)
8 {
9 alert(message1 + (this.x * this.x) + message2);
10 }
11
12 function g(object, func, args)
13 {
14 func.apply(object, args);
15 }
16
17 g(o, f1, ["the value of x = "]);
18 g(o, f2, ["the value of x squared = ", ". Wow!"]);
Add comment August 27, 2009
Passing Parameters on Javascript File
I’ve been amazed by these codes.. passing parameters on javascript file.. so I decided to share how this thing works…
// test javascript
/*
<script src=”js/jquery.js” type=”text/javascript”></script>
<script id=”jsf1″ src=”js_test.js?xerxis,alvar” type=”text/javascript”></script>
*/
Add comment August 27, 2009
Computer Technician Leveling
I got this from a forum… what level are you in?
my base level of computer technician
end user computer technician?
marunong ka magbukas, gumamit, at magshutdown ng computer..
beginner computer technician?
marunong ka magformat, partition, magcopy paste, mag-install and mag-uninstall ng mga softwares.
intermediate computer technician?
marunong ka magkabit ng memory card, video card, harddisk, motherboard, processor, printer. magtweak ng windows, magdownload ng softwares.
advance computer technician?
marunong ka magnetworking ng mga pc units, mga firewall settings, limiting bandwidth, troubleshooting ng dsl. troubleshoot pc hardwares and softwares.
expert computer technician?
network using linux, magpalit ng mga capacitor sa motherboard, modification of cooling system ng pc, maintaining more than 30+ pc units.
Add comment July 16, 2009
kaixersoft (UTILITY_v1.js) (cookie Module)
Finally I applied Module Pattern on my utility frameworks :
/*
Copyright (c) 2009, KaixersofT All Rights Reserved.
http://kaixersoft.wordpress.com
xerxis anthony b. alvar
kaixersoft@gmail.com
*/
(more...)
Add comment June 18, 2009
Javascript Design Pattern (Prototype)
I dont know what to call this one, ‘coz others call it Prototype and some call it custom objects.
The idea is the same with the Module pattern, to keep private objects and public object;
var Student = function() {}(); << — Object constructor
or
var Student = {}; <<<— this comes more handy ^_^
Add comment June 18, 2009
Javascript Design Pattern (Module)
Ok this one is another design pattern, the goal is to keep private objects from public objects. Only functions inside the function block can access private variables and methods.
Let us improve our previous (singleton ) pattern
Add comment June 18, 2009
Javascript Design Pattern (Singleton)
hi I’ve been reading a lot about design patterns, I just want to share stuff about design patterns that at first I was bored reading and analysing things up.
This is the Singleton javascript design pattern :
Goal :
Student <<– this will be the object
Notebook <<– this is one of our object’s property
Name <<– Another property of our object.
Add comment June 18, 2009
Self-Invoking Function (function(){..stament..})();
As I was continuing exploring Javascript Design Pattern, I bumped in to this topic. A weird looking code that for a beginner, it will be a pain in the 4$$.
Add comment June 17, 2009