preface

A few days ago, I saw a popular article on digging gold “the days when I was an interviewer in Cool Kale”. The author of this article elaborates on what skills you should have as a Web candidate to be more marketable from an interviewer’s perspective.

In the process of comparing myself, I found some problems, maybe understand, but not comprehensive, which is also the reason for the birth of this series of articles.

What is a stack

The primitive type of storage space in JavaScript contains:

  • Boolean
  • Null
  • Undefined
  • Number
  • String
  • Symbol (new definition in ECMAScript 6)

Prototype types are stored In stack memory, fixed In size and ordered, following the last-in-first-out principle

In life, it is similar to organizing a book (the last book to be organized is always on top) :

What is a pile of

In addition to primitive JavaScript data types, there is another class of JavaScript data types called Object, which contains:

  • Object
  • Function
  • Array
  • Date
  • RegExp

Object types are stored in heap memory and are variable in size and complexity.

To be precise:

Pointers to data of type Object are stored in stack memory space, and the value that the pointer actually points to is stored in heap memory space

What is a queue

The storage properties of queues and stack memory are similar

Queues are of variable size and ordered, following the first-in-first-out principle

It is in life, more types of queuing scene (first in line, first to eat) :

reference

  • One point a day – talk about JavaScript data types

series

  • One knowledge point a day