Javascript Cheatsheet Table of contents [1]Global [2]Any object [3]Array [4]Boolean [5]Date [6]Function [7]Math [8]Number [9]Object [10]RegExp [11]String [12]XMLHttpRequest [13]About Global Properties Infinity NaN undefined Methods eval(string [, object]) isFinite(number) isNaN(number) parseFloat(string) parseInt(string) encodeURI(string) decodeURI(string) encodeURIComponent(string) decodeURIComponent(string) Any object Properties constructor prototype Methods toSource() toString() valueOf() Array Constructors new Array(length) new Array(el0, el1, ...) [el0, el1, ...] Properties length Methods (mutators) pop() push(el0, el1, ...) reverse() shift() splice(index, count [, el0, el1, ...]) unshift() Methods (accessors) concat(add0, add1, ...) join(separator) slice(begin [, end]) Boolean Constructors new Boolean(value) Date Constructors new Date(milliseconds) new Date(string) new Date(yr_num, mo_num, day_num [, hr_num, min_num, sec_num, ms_num]) Methods (static) Date.now() Date.parse(string) Date.UTC(yr_num, mo_num [, day_num hr_num, min_num, sec_num, ms_num]) Methods getDate() getDay() getFullYear() getMilliseconds() getMinutes() getMonth() // zero-based getSeconds() getTime() getTimezoneOffset() setDate(month_day) setFullYear(year) setMilliseconds( millisec ) setMinutes(minutes) setMonth(month) // zero-based setSeconds(seconds) setTime(timestamp) Operators date1 - date2 // time in milliseconds More [14]Date object reference Function Constructors new Function([arg1, ...,] function_body) Properties length Methods apply(this_arg [, arguments]) call(this_arg [, arg1, ...]) Math Properties E // Euler's constant, ~ 2.718 LN2 // Natural logarithm of 2, ~ 0.693. LN10 // Natural logarithm of 10, ~ 2.302 LOG2E // Base 2 logarithm of E, ~ 1.442 LOG10E // Base 10 logarithm of E, ~ 0.434 PI // ~ 3.14159 SQRT1_2 // sqrt(1/2) or 1/sqrt(2), ~ 0.707 SQRT2: Square root of 2, ~ 1.414 Methods (static) abs(number) acos(number) // Return radians asin(number) // Return radians atan(number) // Return radians atan2(number) // Return radians ceil(number) exp(number) floor(number) log(number) max([n1, n2, ...]) min([n1, n2, ...]) pow(base, exponent) random() round(number) sin(number) sqrt(number) tan(number) // Take radians Number Constructors new Number(value) number Properties MAX_VALUE MIN_VALUE NaN NEGATIVE_INFINITY POSITIVE_INFINITY Methods toExponential( [fraction_digits] ) toFixed([digits]) toLocaleString() toPrecision([precision]) Object Constructors new Object() {[property: value, ...]} RegExp Constructors new RegExp(pattern [, flags]) /pattern/flags Properties global ignoreCase lastIndex multiline source Methods exec(string): {index: number, input: string, 0: matched, 1: paran1, ...} test(string) String Constructors new String(string) "string" Properties length Methods (static) String.fromCharCode( array ) Methods charAt(index) charCodeAt(index) concat(string1, ...) indexOf(string [, fromIndex]) // -1 on failure lastIndexOf(string [, fromIndex]) // -1 on failure match(regexp) replace(regexp|substr, new_substr|function) search(regexp) // -1 on failure slice(start [, end]) split(by_string [, limit]) substr(start [, length]) substring(start [, end]) toLowerCase() toUpperCase() More [15]String object reference XMLHttpRequest Constructors new XMLHttpRequest() Properties onerror onload onprogress onreadystatechange readyState responseText responseXML status Methods open(method, URL, synchronous) send(data) overrideMimeType(data) setRequestHeader(header, value) getResponseHeader(header) send(data) Progress event properties position totalSize About Author [16]Felix Pleşoianu License [17]Creative Commons: Attribution-Sharealike v2.5 Credits [18]Mozilla Developer Center References 1. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#global 2. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#any 3. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#array 4. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#boolean 5. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#date 6. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#function 7. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#math 8. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#number 9. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#object 10. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#regexp 11. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#string 12. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#xhr 13. file://localhost/home/felix/Projects/js-cheatsheet/js-cheatsheet-1_1/index.html#about 14. http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Date 15. http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:String 16. http://felix.plesoianu.ro/ 17. http://creativecommons.org/licenses/by-sa/2.5/ 18. http://developer.mozilla.org/