brunosduarte / github-blog

1 stars 0 forks source link

JavaScript data types and data structures #2

Open brunosduarte opened 3 months ago

brunosduarte commented 3 months ago

Programming languages all have built-in data structures, but these often differ from one language to another. This article attempts to list the built-in data structures available in JavaScript and what properties they have. These can be used to build other data structures. Wherever possible, comparisons with other languages are drawn.

Dynamic typing

JavaScript is a loosely typed and dynamic language. Variables in JavaScript are not directly associated with any particular value type, and any variable can be assigned (and re-assigned) values of all types:

let foo = 42;         //foo is now a number
foo = 'bar';          //foo is now a string
foo = true;           //foo is now a boolean

Where Find Me

Linkedin GitHub

brunosduarte
brunosduarte commented 3 months ago

Great post!

This seems to be an excellent post!

if (post === 'excel') {
  return true
}
brunosduarte commented 3 months ago

Wrong post!

This seems to be a wrong post!

if (post === 'wrong') {
  return true
}
brunosduarte commented 3 months ago

Odd post!

This seems to be an odd post!

if (post === 'odd') {
  return true
}