Skip to content

Instantly share code, notes, and snippets.

View stevez's full-sized avatar

Steve Zhang stevez

  • Markham, Ontario, Canada
View GitHub Profile
//call before function foo is defined
foo(); //=> alert("foo");
function foo() {
alert("foo");
}
//call after function foo is defined
foo(); //=> alert("foo");
var foo = function() {
alert("foo");
};
var foo = function() {
alert("foo");
};
function foo() {
alert("foo");
}
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
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;
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
var F = function() {};
F.prototype.a = 'b';
F.prototype.a; // b
<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}"/>
<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>