728x90
반응형

new Set() Method

  • Passing an array to new Set()
  • Create an empty set and use add() to add values
  • if a specified value exists in a set. use has()
  • .values(), . forEach (function), .keys(), .entries()
  • ex) const letters = new Set(["a","b","c"]); 

new Map() Method

 a map by passing an array to the new Map() constructor

  • value of a key in a map with the get() method
  • elements to a map with the set() method(ex) fruits.set("apples", 500); )
  • .size(), .delete(key), .clear(), .has(key), .entries(), foreach(), . keys(), .values(), 
  • ex) const fruits = new Map([["apples", 500],  ["bananas", 300],  ["oranges", 200]]);

Converting Strings to Numbers

 

Number() Returns a number, converted from its argument
parseFloat() Parses a string and returns a floating point number
parseInt() Parses a string and returns an integer

Converting Numbers to Strings

 

toExponential() Returns a string, with a number rounded and written using exponential notation.
toFixed() Returns a string, with a number rounded and written with a specified number of decimals.
toPrecision() Returns a string, with a number written with a specified length

 

Converting Dates to Strings

MethodDescription

getDate() Get the day as a number (1-31)
getDay() Get the weekday a number (0-6)
getFullYear() Get the four digit year (yyyy)
getHours() Get the hour (0-23)
getMilliseconds() Get the milliseconds (0-999)
getMinutes() Get the minutes (0-59)
getMonth() Get the month (0-11)
getSeconds() Get the seconds (0-59)
getTime() Get the time (milliseconds since January 1, 1970)

 

728x90
반응형

'JAVASCRIPT' 카테고리의 다른 글

[개발자도구] 크롬 개발자도구 복붙 안 될때 !!!!  (3) 2024.12.18
20241202_1 JavaScript Regular Expressions  (14) 2024.12.02
20241125_1 Loop  (12) 2024.11.25
20241122_3 Comparison  (4) 2024.11.22
20241122_2 Math Object  (0) 2024.11.22

+ Recent posts