Some people ask me: How to get my Facebook ID such as: profile, group ,page.
I just find tool to answer this question, everyone can find here: Find My Facebook ID
WE STUDY TOGETHER
Experiences From My Working
Search This Blog
Friday, August 9, 2019
Monday, July 21, 2014
Tuesday, June 10, 2014
Friday, September 27, 2013
Javscript: the different between apply and call.
apply
lets you invoke the function with arguments as an array; call
requires the parameters be listed explicitly.
Pseudo syntax:
theFunction.apply(valueForThis, arrayOfArgs)
theFunction.call(valueForThis, arg1, arg2, ...)
Sample code:
function theFunction(name, profession) {
alert("My name is " + name + " and I am a " + profession + ".");
}
theFunction("John", "fireman");
theFunction.apply(undefined, ["Susan", "school teacher"]);
theFunction.call(undefined, "Claude", "mathematician");
Source:
http://stackoverflow.com/questions/1986896/what-is-the-difference-between-call-and-apply
Monday, February 4, 2013
Saturday, January 12, 2013
Monday, November 26, 2012
Thursday, November 8, 2012
Call function in string javascript
1. Using eval
var strFun1 = "func1";
var ret1 = eval(strFun1);
ret1(1,2,3);
function func1(a,b,c){
alert(a);
alert(b);
alert(c);
}
1. Using Window property (Recommend)
var strFun2 = "func2";
window[strFun2](parmas);
function func2(data){
console.info(data);
}
Friday, November 2, 2012
Difference between function and method in javascript
Every function in JavaScript has a number of attached methods, including toString(), call(), and apply() (remember that every function in JavaScript is an object).
Functions stand on their own (there is an alert() function, for example), while methods are functions inside an object's dictionary, and we invoke them through the object reference
Example:
function foo()
{
alert('x');
}
alert(foo.toString());
------------------------
Functions stand on their own (there is an alert() function, for example), while methods are functions inside an object's dictionary, and we invoke them through the object reference
Example:
function foo()
{
alert('x');
}
alert(foo.toString());
------------------------
fn.call and fn.apply
fn.call(function, [thisObject, [argument1, ..., argumentN]])
is equivalent to function.call(thisObject, argument1, ..., argumentN)
fn.apply(function, [thisObject, [argumentsArray]])
is equivalent to function.apply(thisObject, argumentsArray)
Examples:
function foo(a, b) { return (this*a)-b }
fn.call(foo, 5, 6, 7) == 23
foo.call(5, 6, 7) == 23
fn.apply(foo, 5, [6, 7]) == 23
foo.apply(5, [6, 7]) == 23
-
if (typeof fn == "undefined" ) var fn = {};
-
fn.call = function call(fn /*, [thisp, [arg1, ..., argN]]*/) { return Function.prototype.call.apply(fn, Array.prototype.slice.call(arguments).splice(1, arguments.length)) };
-
fn.apply = function apply(fn, thisp, args) {
-
if ( args ) args.splice(0, 0, thisp);
-
return Function.prototype.call.apply(fn, args)
-
};
Sunday, January 15, 2012
Subscribe to:
Posts (Atom)