Learn js

Learn js

Some methods and properties of JavaScript

  • ArrayObject\color{#4B0082}{Array object}

    1. ArrayAttributes\color{#1E90FF}{Array property}

    • constructor\color{green}{constructor} -returns the prototype function for creating an array object
    • length\color{green}{length} -set or return the number of array elements
    • prototype\color{green}{prototype} -allows you to add properties or methods to array objects
    1. ArrayObject method\color{#1E90FF}{Array object method}

    • Concatenate two or more arrays and return the result- concat()\color{green}{concat()}
    • Use the elements of the array to form a string- join()\color{green}{join()}
    • Calculate array elements as a value (from left to right))- reduce()\color{green}{reduce()}
    • Calculate array elements as a value (from right to left)- reduceRight()\color{green}{reduceRight()}
    • Reverse the order of the elements in an array to sort reverse()\color{green}{reverse()}
    • Delete the last element of the array- pop()\color{green}{pop()}
    • Delete the first element of the array- shift()\color{green}{shift()}
    • Add or remove elements from the array splice()\color{green}{splice()}
    • Select elements from an array- slice()\color{green}{slice()}
    • Array sort (in alphabetical order)- sort()\color{green}{sort()}
    • Returns an iterable object of the array entries()\color{green}{entries()}
    • Index value- indexOf()\color{green}{indexOf()}
    • Search for an element in the array and return the position where it last appeared- lastIndexOf()\color{green}{lastIndexOf()}
    • Returns the array elements that meet the conditions of the incoming test (function)- find()\color{green}{find()}
    • Returns the index of the array element that meets the conditions of the incoming test (function)- findIndex()\color{green}{findIndex()}
    • Add an element to the second position of the array- splice()\color{green}{splice()}
    • Convert array to string-toString()\color{green}{toString()}
    • Add a new element at the beginning of the array- unshift()\color{green}{unshift()}
    • Check whether each element of the numeric element meets the condition- every()\color{green}{every()}
    • Use a fixed value to fill the array fill()\color{green}{fill()}
    • Detect numeric elements and return an array of all elements that meet the conditions- filter()\color{green}{filter()}
    • The callback function is executed once for each element of the array forEach()\color{green}{forEach()}
    • Create an array from the given object- from()\color{green}{from()}
    • Determine whether an array contains a specified value- includes()\color{green}{includes()}
    • Determine whether the object is an array- isArray()\color{green}{isArray()}
    • Returns an iterable of the array, including the key of the original array- keys()\color{green}{keys()}
    • Process each element of the array through the specified function, and return the processed array- map()\color{green}{map()}
    • Add one or more elements to the end of the array and return the new length- push()\color{green}{push()}
    • Check whether any element in the array element meets the specified conditions- some()\color{green}{some()}
    • Copy elements from a specified position in the array to another specified position in the array- copyWithin()\color{green}{copyWithin()}
    • Return the original value of the array object- valueOf()\color{green}{valueOf()}
  • Math(Arithmetic) Object\color{#4B0082}{Math (arithmetic) object}

  1. Mathmethod\color{#1E90FF}{Math Method}
    • Round a number- Math.round()\color{green}{Math.round()}
    • random number - (Math.random()\color{green}{(Math.random()}
    • Convert array to string-toString()\color{green}{toString()}
    • Add a new element at the beginning of the array- unshift()\color{green}{unshift()}
  1. MathAttributes\color{#1E90FF}{Math attribute}
    • Returns the arithmetic constant e, which is the base of the natural logarithm (approximately equal to 2.718)- Math.E()\color{green}{Math.E()}
    • Returns the natural logarithm of 2 (approximately equal to 0.693)- Math.LN2()\color{green}{Math.LN2()}
    • Returns the natural logarithm of 10 (approximately equal to 2.302)-Math.LN10()\color{green}{Math.LN10()}
    • Returns the logarithm of e with base 2 (approximately equal to 1.4426950408889634)- Math.LOG2E()\color{green}{Math.LOG2E()}
    • Returns the logarithm of e to the base 10 (approximately equal to 0.434)- Math.LOG10E()\color{green}{Math.LOG10E()}
    • Returns the pi (approximately equal to 3.14159)- Math.PI()\color{green}{Math.PI()}
    • Returns the reciprocal of the square root of 2 (approximately equal to 0.707)-Math.SQRT12()\color{green}{Math.SQRT1_2()}
    • Returns the square root of 2 (approximately equal to 1.414)- Math.SQRT2()\color{green}{Math.SQRT2()}
  • DateObject\color{#4B0082}{Date object}

  1. DateObject method\color{#1E90FF}{Date object method}
    • Return the day of the month (1 ~ 31) from the Date object- getDate()\color{green}{getDate()}
    • Set the day of the month in the Date object (1 ~ 31)- setDate()\color{green}{setDate()}
    • Return the day of the week (0 ~ 6) from the Date object- getDay()\color{green}{getDay()}
    • Set the year (four digits) in the Date object- setDay()\color{green}{setDay()}
    • Return the year as four digits from the Date object getFullYear()\color{green}{getFullYear()}
    • Set the year (four digits) in the Date object-setFullYear()\color{green}{setFullYear()}
    • Returns the hour of the Date object (0 ~ 23)- getHours()\color{green}{getHours()}
    • Set the hour in the Date object (0 ~ 23)- setHours()\color{green}{setHours()}
    • Returns the milliseconds of the Date object (0 ~ 999)- getMilliseconds()\color{green}{getMilliseconds()}
    • Set the milliseconds in the Date object (0 ~ 999)- setMilliseconds()\color{green}{setMilliseconds()}
    • Return the minute of the Date object (0 ~ 59)- getMinutes()\color{green}{getMinutes()}
    • Set the minute in the Date object (0 ~ 59)- setMinutes()\color{green}{setMinutes()}
    • Return the month (0 ~ 11) from the Date object-getMonth()\color{green}{getMonth()}
    • Set the month (0 ~ 11) in the Date object-setMonth()\color{green}{setMonth()}
    • Returns the number of seconds of the Date object (0 ~ 59)- getSeconds()\color{green}{getSeconds()}
    • Set the seconds in the Date object (0 ~ 59)- setSeconds()\color{green}{setSeconds()}
    • Returns the number of milliseconds since January 1, 1970- getTime()\color{green}{getTime()}
    • Returns the number of milliseconds from January 1, 1970 to the specified date according to universal time- UTC()\color{green}{UTC()}
    • Set the Date object in milliseconds- setTime()\color{green}{setTime()}
    • Returns the minute difference between local time and Greenwich Mean Time (GMT)- getTimezoneOffset()\color{green}{getTimezoneOffset()}
    • Return the day of the month (1 ~ 31) from the Date object according to universal time- getUTCDate()\color{green}{getUTCDate()}
    • Set the day of the month in the Date object according to universal time (1 ~ 31)- setUTCDate()\color{green}{setUTCDate()}
    • Returns the number of milliseconds from midnight on January 1, 1970 to the specified date (string)- parse()\color{green}{parse()}
    • Convert the date part of the Date object to a string- toDateString()\color{green}{toDateString()}
    • Return date string in JSON data format- toJSON()\color{green}{toJSON()}
    • According to the local time format, convert the date part of the Date object into a string- toLocaleDateString()\color{green}{toLocaleDateString()}
    • According to the local time format, convert the time part of the Date object into a string- toLocaleTimeString()\color{green}{toLocaleTimeString()}
    • According to the local time format, the Date object is converted to a string- toLocaleString()\color{green}{toLocaleString()}
    • Convert Date object to string- toString()\color{green}{toString()}
  1. DateObject attributes\color{#1E90FF}{Date object attribute}
    • Return a reference to the Date function that created this object constructor\color{green}{constructor}
    • Add properties and methods to objects prototype\color{green}{prototype}
  • StringObject\color{#4B0082}{String object}

  1. StringObject method\color{#1E90FF}{String object method}
    • Return the character at the specified position- charAt()\color{green}{charAt()}
    • Returns the Unicode encoding of the character at the specified position- charCodeAt()\color{green}{charCodeAt()}
    • Concatenate two or more strings and return a new string- concat()\color{green}{concat()}
    • Convert Unicode encoding to characters- fromCharCode()\color{green}{fromCharCode()}
    • Returns the position of the first occurrence of a specified string value in the string-indexOf()\color{green}{indexOf()}
    • Find whether the string contains the specified substring-includes()\color{green}{includes()}
    • Search the string from back to front, and start counting from the starting position (0) to return the position of the last occurrence of the string- lastIndexOf()\color{green}{lastIndexOf()}
    • Find one or more regular expression matches- match()\color{green}{match()}
    • Copy the string a specified number of times, and concatenate them together to return- repeat()\color{green}{repeat()}
    • Find the matching substring in the string, and replace the substring matching the regular expression- replace()\color{green}{replace()}
    • Find the value that matches the regular expression search()\color{green}{search()}
    • Extract fragments of the string, and return the extracted part in the new string- slice()\color{green}{slice()}
    • Split the string into an array of strings-split()\color{green}{split()}
    • Check whether the string starts with the specified substring-startsWith()\color{green}{startsWith()}
    • Extract the specified number of characters in the string from the starting index number- substr()\color{green}{substr()}
    • Extract the characters between two specified index numbers in a string- substring()\color{green}{substring()}
    • Convert the string to lowercase- toLowerCase()\color{green}{toLowerCase()}
    • Convert string to uppercase- toUpperCase()\color{green}{toUpperCase()}
    • - trim()\color{green}{trim()}
    • - toString()\color{green}{toString()}
    • - valueOf()\color{green}{valueOf()}
  1. String newString()\color{#1E90FF}{String new String()}
  2. String :\color{#1E90FF}{String :}
    • - constructor\color{green}{constructor}
    • - length\color{green}{length}
    • - prototype\color{green}{prototype}
  • Boolean \color{#4B0082}{Boolean }    
    true 1 false 0

  1. Boolean \color{#1E90FF}{Boolean }
    • Boolean - constructor\color{green}{constructor}
    • - prototype\color{green}{prototype}
  1. Boolean \color{#1E90FF}{Boolean }
    • - toString()\color{green}{toString()}
    • Boolean - valueOf()\color{green}{valueOf()}
  • JavaScript \color{#4B0082}{JavaScript }

    • - Infinity\color{green}{Infinity}
    • - NaN\color{green}{NaN}
    • - undefined\color{green}{undefined}
  • JavaScript \color{#4B0082}{JavaScript }

    • URI - decodeURI()\color{green}{decodeURI()}
    • URI - decodeURIComponent()\color{green}{decodeURIComponent()}
    • URI - encodeURI()\color{green}{encodeURI()}
    • URI - encodeURIComponent()\color{green}{encodeURIComponent()}
    • - escape()\color{green}{escape()}
    • JavaScript - eval()\color{green}{eval()}
    • - isFinite()\color{green}{isFinite()}
    • - isNaN()\color{green}{isNaN()}
    • - Number()\color{green}{Number()}
    • - parseFloat()\color{green}{parseFloat()}
    • - parseInt()\color{green}{parseInt()}
    • - String()\color{green}{String()}
    • escape() - unescape()\color{green}{unescape()}
  • JavaScript \color{#4B0082}{JavaScript }

  • + - */% ++ --

  • JavaScript \color{#4B0082}{JavaScript }

  • = += -= *=/= %=

  • JavaScript \color{#4B0082}{JavaScript }

  • + +=

  • JavaScript \color{#4B0082}{JavaScript }

  • == === != !== > >= < <=

  • JavaScript \color{#4B0082}{JavaScript }

  • && || !

  • JavaScript \color{#4B0082}{JavaScript }

  • &AND |OR ~ ^ << >>