This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //call before function foo is defined | |
| foo(); //=> alert("foo"); | |
| function foo() { | |
| alert("foo"); | |
| } | |
| //call after function foo is defined | |
| foo(); //=> alert("foo"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var foo = function() { | |
| alert("foo"); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var foo = function() { | |
| alert("foo"); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function foo() { | |
| alert("foo"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var F = function() {}; // This is a function object. | |
| var p = F.prototype; // This is the prototype object associated with it. | |
| var c = p.constructor; // This is the function associated with the prototype. | |
| var c === F; // => true: F.prototype.constructor==F for any function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var F = function() {}; | |
| F.prototype.a = 'b'; | |
| var s = new F(); | |
| print(s.a); | |
| print(s.hasOwnProperty('a')); //false | |
| s.a = 'c'; // object s will create its new property 'a' | |
| print(s.a); // c | |
| print(s.hasOwnProperty('a')); // true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var s = new F(); // s get the F.prototype | |
| s.a; // return 'b'; | |
| s.prototype; // return undefined | |
| var string = new String(); //get String.property | |
| var array = new Array(); //get Array.property | |
| var num = new Number(); // get Number.property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var F = function() {}; | |
| F.prototype.a = 'b'; | |
| F.prototype.a; // b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <target name="create-cod" if="blackberry.trigger"> | |
| <exec dir="${dist.dir}" executable="java" failonerror="true"> | |
| <arg value="-cp"/> | |
| <arg value="${platform.home}/bin/rapc.jar"/> | |
| <arg value="net.rim.tools.compiler.Compiler"/> | |
| <arg value="import=${platform.bootclasspath}"/> | |
| <arg value="codename=${name}"/> | |
| <arg value="-cldc"/> | |
| <arg value="jad=${basedir}/${dist.dir}/${dist.jad}"/> | |
| <arg value="${basedir}/${dist.dir}/${dist.jar}"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <target name="clean-blackberry" if="blackberry.trigger"> | |
| <delete file="${dist.dir}/${name}.cod" failonerror="false"/> | |
| <delete file="${dist.dir}/${name}.cso" failonerror="false"/> | |
| <delete file="${dist.dir}/${name}*.debug" failonerror="false"/> | |
| <delete failonerror="false"> | |
| <fileset dir="${platform.home}/simulator"> | |
| <include name="**/${name}*.*"/> | |
| </fileset> | |
| </delete> | |
| </target> |