๐Ÿ“
til
  • TIL(Today I Learned)
  • javascript
    • value-number-string-boolean-null-undefined
    • primitive-reference
    • Hoisting
    • Prototypes in Javascript
    • this
    • prototype
    • ์ฝœ๋ฐฑํ•จ์ˆ˜ (Callback function)
    • ํ•จ์ˆ˜์˜ ํ˜ธ์ถœ
    • ์ž๋ฃŒ๊ตฌ์กฐ new keyword
    • closure
    • Promise
    • event-loop
    • array-object
    • ๊ฐ์ฒด
    • Arguments
    • higher order function
    • operators-function-control-flow
    • ๊ฐ์ฒด ์ƒ์„ฑ ํŒจํ„ด 3๊ฐ€์ง€
    • Javascript scopes
    • Functional Programming
    • Design Patterns
    • ๋ฐ์ดํ„ฐ ํƒ€์ž…
    • Object ๊ฐ์ฒด
    • ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ํ™•์žฅ
    • ์ฐธ์กฐ
    • ํ•จ์ˆ˜
    • ์ƒ์†(Inheritance)
    • this - 'this'๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ•ด๋‹น ํ•จ์ˆ˜๋ฅผ '์–ด๋–ป๊ฒŒ' ์‹คํ–‰ํ•˜๋А๋ƒ์— ๋”ฐ๋ฅธ 4๊ฐ€์ง€ this ์ •์˜
    • ์ „์—ญ๊ฐ์ฒด(Global object)
    • ๊ฐ์ฒด ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ
    • The 'new' keyword - Object Creation in JavaScript
  • javascript-api
    • Number
      • Number.MAX_VALUE
      • Number.isInteger
      • Number.NEGATIVE_INFINITY
      • Number.isNaN()
      • Number.POSITIVE_INFINITY
      • Number.parseFloat
      • Number.EPSILON
      • number.toExponential
      • Number.MAX_SAFE_INTEGER
      • Number1 - ์ž์—ฐ์ˆ˜, ์ •์ˆ˜, 10์ง„์ˆ˜, 2์ง„์ˆ˜, ๋ถ€๋™์†Œ์ˆ˜์ , ์‹ค์ˆ˜
      • Number.isSafeInteger()
      • Number.MIN_VALUE
      • Number.parseInt
      • Number.NaN
      • Number.isFinite()
      • Number.MIN_SAFE_INTEGER
      • toFixed
    • string.split
    • String.fromCodePoint
    • string.trimEnd
    • string.padStart
    • string.@@iterator
    • String.fromCharCode
    • string.toUpperCase
    • string.codePointAt
    • string.toLowerCase()
    • string.toString
    • string.includes
    • string.replace()
    • string.charAt
    • String.lastIndexOf
    • string.slice
    • string.search
    • string.padEnd
    • string.substring
    • string.length
    • string.trim
    • string.localeCompare
    • String.indexOf
    • string.endsWith
    • string.valueOf
    • String.raw
    • string.matchAll()
    • string.repeat
    • string.match
    • String.prototype
    • string.startsWith
    • string.charCodeAt
    • string.trimStart
    • string.concat
    • string.toLocaleUpperCase()
    • string.toLocaleLowerCase
    • String
  • learn-node
    • debugger
    • Tip
  • schema-design
    • Database Schema Design
    • Database Schema Design
  • react
    • LifeCycle
    • redux
    • Context API
    • ํ•จ์ˆ˜ํ˜• ์ปดํฌ๋„ŒํŠธ์™€ ํด๋ž˜์Šค, ์–ด๋–ค ์ฐจ์ด๊ฐ€ ์กด์žฌํ• ๊นŒ?
    • Hooks๊ณผ useEffect ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ
    • Route
    • async wait ์‚ฌ์šฉํ•˜๊ธฐ
    • Hooks API Reference
    • context
    • npm uninstall ํ•˜๋Š”๋ฒ•
    • test ๋งŒ๋“ค๊ธฐ
  • tip
    • ํด๋ฆฐ์ฝ”๋“œ
    • BxSlider๋กœ ํ…์ŠคํŠธ ํ๋ฅด๋Š” ํšจ๊ณผ ๋งŒ๋“ค๊ธฐ
  • javascript30
    • Event Capture, Propagation, Bubbling and Once
    • Object and Arrays - Reference VS Copy
  • typescript
    • ์šฐ์•„ํ•œ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ 2๋ถ€
    • The Basic Cheatsheet
    • TypeScript
    • Type Guards and Differnetiating Types
    • ์šฐ์•„ํ•œ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ
    • Generics
  • git-from-the-hell
    • git
    • init-status-add-commit-log-stage-repository
    • log-diff
    • ๋จธ์ง€ ํ›„ branch ์‚ญ์ œํ•˜๊ธฐ
    • ์ง€์˜ฅ์—์„œ ์˜จ Git
    • reset-revert
    • develop branch ๋ฅผ pull ํ•˜๊ณ  ์‹ถ์„๋•Œ
  • conference-and-seminar
    • ๋ชจ๋˜ ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœํ™˜๊ฒฝ์˜ ์ดํ•ด
  • fire-base
    • Firebase .gitignore
  • vanillacoding
    • Data Structures
    • Sorting Algorithms - part 1
    • Promise
    • class
    • 04.quiz
    • 07.event-loop
    • Design Patterns
    • OOP (Object Oriented Programming)
  • etc
    • ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ฝ”๋“œ๋ฆฌ๋ทฐ
    • ์Šค์Šค๋กœ ๊ณต๋ถ€ํ•˜๋Š” ๋ฒ•
    • ๋ฐ”๋‹๋ผ์ฝ”๋”ฉ ์ˆ˜๊ฐ• ํ›„๊ธฐ
    • async ๊ณผ์ œ ํ›„๊ธฐ - ๋น„๋™๊ธฐ, ๋™๊ธฐ, ํด๋กœ์ €, ๋ฐฐ์—ด๊ณผ ๊ฐ์ฒด
    • ์œ ์šฉํ•œ ์‚ฌ์ดํŠธ
  • algorithm
    • The Supermarket Queue
    • Find the odd int
    • The Office III - Broken Photocopier
    • Directions Reduction
    • The Office II - Boredom Score
    • Divisible Sum Pairs
    • Codewars ์ด์šฉ์ž ์†”๋ฃจ์…˜ ๋ชจ์Œ
    • Shortest Word
    • find key
    • Two Sum
    • Simple Pig Latin
  • Book
    • the essence of object-orientation
      • ํƒ€์ž…๊ณผ ์ถ”์ƒํ™”
      • ๊ฐ์ฒด ์ง€๋„
      • ์ด์ƒํ•œ ๋‚˜๋ผ์˜ ๊ฐ์ฒด
      • ์ถ”์ƒํ™” ๊ธฐ๋ฒ•
      • 05. ์ฑ…์ž„๊ณผ ๋ฉ”์‹œ์ง€
      • 07.ํ•จ๊ป˜ ๋ชจ์œผ๊ธฐ
      • 04. ์—ญํ• , ์ฑ…์ž„, ํ˜‘๋ ฅ
      • ํ˜‘๋ ฅํ•˜๋Š” ๊ฐ์ฒด๋“ค์˜ ๊ณต๋™์ฒด
  • ecma-script2015
    • Object Literal Upgrades
    • default-parameter-template-literals-arrow-functions
    • spread-operator-rest-param
    • let-const-rest-parameter-spread-operator-destructuring
  • http
    • ์›น ๋ธŒ๋ผ์šฐ์ €์— URL์„ ์ž…๋ ฅํ–ˆ์„ ๋•Œ ์–ด๋–ป๊ฒŒ ์›น ํŽ˜์ด์ง€๊ฐ€ ๋ณด์—ฌ์งˆ๊นŒ?
  • jest
    • toThrow(error?)
  • data-structures
    • Data Structures
  • express
    • express generator
    • CORS
  • css-flexible-box-layout
    • flex ํ•ด๋ฒ„๋ ธ์ง€ ๋ญ์•ผ
  • git
    • Git
  • mongodb
    • MongoDB
  • markdown
    • use-markdown
  • cmder
    • cmd ๋ช…๋ น์–ด ๋ชจ์Œ
  • debug
    • trackClicksEx function error
  • npm
    • NPM TOKEN ์„ค์ •ํ•˜๊ธฐ
  • storybook
    • Storybook
  • sort
    • Sorting Algorithms - part 1
  • javascript-koans
    • Javascript Koans ์˜ค๋‹ต๋…ธํŠธ
  • rxjs
    • Rx.js
  • dom-elements
    • HTML Element
  • redux-toolkit
    • Redux Toolkit
  • github-actions
    • GitHub Actions
  • redux-middleware
    • redux middleware
  • rest
    • rest
  • css-rendering
    • ์ฝ”๋“œ ์Šคํ”ผ์ธ  - CSS Rendering 1ํšŒ์ฐจ 2/2
    • ์ฝ”๋“œ ์Šคํ”ผ์ธ  - CSS Rendering 1ํšŒ์ฐจ 1/2
  • you-dont-know-js
    • ํƒ€์ž…
  • server
    • # shutdown local server
  • semantic-versioning
    • Semantic Versioning 2.0.0
Powered by GitBook
On this page
  • ์‹œ์ž‘ํ•˜๊ธฐ ์ „์—
  • Table of Contents
  • value
  • Type
  • Number
  • isInteger
  • Arithmetic_Operators
  • comparison operators
  • Special numbers
  • NaN
  • String
  • comparison
  • Characteristics
  • Boolean
  • Truthy & Falsy
  • null & undefined
  • undefined
  • null

Was this helpful?

  1. javascript

value-number-string-boolean-null-undefined

PreviousjavascriptNextprimitive-reference

Last updated 5 years ago

Was this helpful?

์‹œ์ž‘ํ•˜๊ธฐ ์ „์—

  • ๊ธฐ๋Šฅ ๊ตฌํ˜„ ์—๋งŒ ์ง‘์ค‘

  • ์ธ๋‚ด์‹ฌ์„ ๊ธฐ๋ฅธ๋‹ค.

  • ์งˆ๋ฌธ์„ ํ•˜๊ธฐ ์ „์— ๋ฐ˜๋“œ์‹œ ๊ผผ๊ผผํ•˜๊ฒŒ ์กฐ์‚ฌํ•ด๋ณด๊ณ  ๊นŠ๊ฒŒ ์ƒ๊ฐํ•ด๋ณด๋Š” ์‹œ๊ฐ„์„ ๊ฐ–๋Š”๋‹ค.

  • ์ตœ๋Œ€ํ•œ ์Šค์Šค๋กœ ํ•ด๊ฒฐํ•˜๋„๋ก ๋…ธ๋ ฅํ•œ๋‹ค.

  • ์˜์–ด๋ฅผ ๋‘๋ ค์›Œ ํ•˜์ง€๋งˆ๋ผ

  • ๊ฐ™์€ ์‹ค์ˆ˜๋ฅผ ๋ฐ˜๋ณตํ•˜์ง€ ์•Š๊ธฐ

  • ๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ๊ธฐ๋กํ•œ๋‹ค.

  • ์ฝ”๋“œ๋Š” ์‚ฌ๋žŒ์ด ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด ์“ฐ๋Š”๊ฒƒ. ์ข‹์€ ์ฝ”๋“œ๋ฅผ ์“ฐ๋„๋ก ํ•˜์Ÿˆ 'ใ…'

Table of Contents

value

var catAge = 7;
  • ๊ฐ’์ด๋‹ค.

  • ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ๋ฅผ ์“ฐ๊ฒŒ๋˜๋ฉด ๊ฐ’์„ ๋‹ค๋ฃจ๊ณ  ๋„˜๊ธฐ๊ณ  ๋ฐ›๊ธฐ

  • ํ•œ๊ธ€์ž๋„ ๋‹ค ์•Œ๊ณ  ์จ๋ผ

  • ์นด๋ฉœ์ผ€์ด์Šค๋ฅผ ์ถ”์ฒœ

Type

console.log(typeof 1); //"number"
  • ๋ฌธ์ž์—ด(์ŠคํŠธ๋ง์œผ๋กœ)๋กœ number๊ฐ€ ๋‚˜์˜จ๋‹ค.

  • ๋ชจ๋“ ๊ฑธ ๋ฌธ์ž์—ด๋กœ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

Available types in Javascript

  • String Type

  • Number Type

  • Boolean Type

  • Null Type

  • Undefined Type

  • Object Type

  • Symbol Type (new in ES2015)

Number

isInteger

์ •์ˆ˜์ธ์ง€ ํŒ๋ณ„ํ›„ true / false ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

Number.isInteger(0);         // true
Number.isInteger(1);         // true
Number.isInteger(-100000);   // true
Number.isInteger(99999999999999999999999); // true

Number.isInteger(0.1);       // false
Number.isInteger(Math.PI);   // false

Number.isInteger(NaN);       // false
Number.isInteger(Infinity);  // false
Number.isInteger(-Infinity); // false
Number.isInteger('10');      // false
Number.isInteger(true);      // false
Number.isInteger(false);     // false
Number.isInteger([1]);       // false

Arithmetic_Operators

Addition (+)

// Number + Number -> addition
1 + 2 // 3

// Boolean + Number -> addition
true + 1 // 2

// Boolean + Boolean -> addition
false + false // 0

Exponentiation (**)

a ** b // a์˜ 3์ œ๊ณฑ

comparison operators

8 === 8;
8 !== 9;

์ตœ๋Œ€ํ•œ 3๊ฐœ๋ฅผ ์“ฐ๋„๋ก ํ•œ๋‹ค.

Special numbers

NaN
-0
Infinity
-Infinity

๊ฐ’์„ ํ‘œ๊ธฐํ•ด์ฃผ๋Š” ํŠน๋ณ„ํ•œ ํ‚ค์›Œ๋“œ์ธ๋ฐ ์ˆซ์ž๋‹ค.

NaN

0 / 0; //NaN
1 * 'hello'; //NaN 

console.log(typeof NaN); //"number"
NaN === NaN //true

String

comparison

'a' < 'b'; // true
'aaa' < 'abc'; // treu
'a' < 'Z'; // false
'ํ•œ๊ธ€' < 'ํ•œ๊ตญ์–ด'; // false
'2' < '10'; // false

๋ฌธ์ž์—ด๋ผ๋ฆฌ ๋น„๊ต๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค.

Characteristics

Stringโ€‹.prototypeโ€‹.concat()

'hello'.concat('fun', 'javascript'); //"hellofunjavascript"

๋ฌธ์ž์—ด์€ ์ธ๋ฑ์Šค ์œ„์น˜๋กœ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋‹ค.

var a = 'hello'
console.log(a[3]); // l

๋ฌธ์ž์—ด์€ ์ธ๋ฑ์Šค ์œ„์น˜๋กœ ์ด๋ฏธ ๋งŒ๋“ ๊ฑธ ๋„ฃ์„ ์ˆ˜ ์—†๋‹ค.

var a = 'hello'
a[3] = 'o';
console.log(a); //"hello"

์ธ๋ฑ์Šค 3๋ฒˆ์งธ ์œ„์น˜์— o๊ฐ€ ์œ„์น˜ํ•˜์ง€ ์•Š๊ณ  ๊ทธ๋Œ€๋กœ l์ด ์œ„์น˜ํ•œ๋‹ค.

Boolean

Truthy & Falsy

undefined;
null;
0;
-0;
NaN;
false;
'';
"";

๊ณต๋ฐฑ์กฐ์ฐจ ์—†๋Š” ๋นˆ ๋ฌธ์ž์—ด์ด์—ฌ์•ผ ํ•œ๋‹ค

์ด ๊ฐ’์„ ์ œ์™ธํ•˜๊ณค ๋ชจ๋‘ true

null & undefined

undefined

  • ์–ด๋–ค ๋ณ€์ˆ˜์˜ ๊ฐ’์ด ์•„์ง ํ• ๋‹น๋˜์–ด์ง€์ง€ ์•Š์•˜์Œ์„ ์˜๋ฏธ

  • ์ง์ ‘ undefined๋ฅผ ํ• ๋‹นํ•˜๋Š” ๊ฒฝ์šฐ๋Š” ์—†์–ด์•ผ ํ•œ๋‹ค.

null

  • ์—†๋Š” ๊ฐ’

  • ์žˆ๋‹ค๊ฐ€ ์—†์–ด์ง„ ๊ฐ’์ผ ์ˆ˜๋„ ์žˆ๊ณ , ์• ์ดˆ์— ์—†์„ ์ˆ˜๋„ ์žˆ๋‹ค.

  • ์—†๋Š” ๊ฐ’์„ ๋‚˜ํƒ€๋‚ด๊ณ  ์‹ถ์„๋•Œ ํ”„๋กœ๊ทธ๋ž˜๋จธ๋Š” undefined๋ฅผ ๋„ฃ์ง€ ๋ง๊ณ  null๊ฐ’์„ ์ž…๋ ฅํ•œ๋‹ค.

typeof(null); //object ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ mistake ์ด์Šˆ์žˆ์Œ

์ฐธ๊ณ  MDN
Stringโ€‹.prototypeโ€‹.concat() MDN
Null & Undefined
Value
Number
String
Boolean