Sitemap

Conditional

Nov 12, 2020

--

CONDITIONAL(조건문)

Always need ‘Comparison Operator’(비교 연산자)

  • > more than
  • < less than
  • >= ane more
  • <= and less
  • === equal
  • !== not equal
  • Result is always ‘boolean’(true/false)
  • else can be omitted depends on function.

To apply 2 conditions together, use ‘Logical Operator’(논리 연산자)

AND: &&

OR: ||

NOT: ! (falsy) **memorize

Number.isNaN(anything)

STRING METHODS = IMMUTABLE

  • If you do string type + any different type, it becomes string type automatically.

Get Joo Hee Paige Kim’s stories in your inbox

Join Medium for free to get updates from this writer.

length,

find value,

  • if there is no value, it returns -1

lastIndexOf

  • find index from the back and check the order from the front.

str.includes(searchValue)

  • does not work at outdated browser and returns as Boolean

separate,

get certain values from the string,

Uppercase/Lowercase

Math

  • Math.floor(x) = 내림;
  • Math.ceil(x) = 올림;
  • Math.round(x) = 반올림;
  • Math.pow(base, exponent) = 제곱

trim() : remove space inside string

\n : new line

--

--