Skip to main content

Command Palette

Search for a command to run...

Learning Javascript

Updated
2 min read
A

I am a computer geek from open source.

I have been learning JavavScript since last year this is what I have learned till now

  • It is a loosely typed language but it is dynamic.

  • It is extensively used in the server-side rendering of data hence more powerful than other scripting languages.

  • Everything in JavaScript is not an object as in Python or Java

    • Things which are not Objects:

      • Numbers

      • String

      • null

      • undefined

      • Boolean

      • Symbols

Unlike objects, primitive values are immutable. The situation is complicated by the fact that these primitives do have object wrappers (String, Number and Boolean); these objects have methods and properties while the primitives do not, but the primitives appear to have methods because JavaScript silently creates a wrapper object when code attempts to access any property of a primitive.

var s = "foo";
var sub = s.substring(1, 2); // sub is now the string "o"

Behind the scenes, s.substring(1, 2) behaves as if it is performing the following (approximate) steps:

  1. Create a wrapper String primitive type of datastructure from s, equivalent to using new String(s)

  2. Call the substring() method with the appropriate parameters on the String primitive data structure returned by step 1

  3. Dispose of the String object

  4. Return the string (primitive) from step 2.

A consequence of this is that while it looks as though you can assign properties to primitives, it is pointless because you cannot retrieve them:

var s = "foo";
s.bar = "cheese";
alert(s.bar); // undefined

This happens because the property is effectively defined on a String object that is immediately discarded.

My NodeJs Learning

Part 1 of 1

This series will be based on real industry-based solutions to the problems I'm facing in my career as a Software Engineer in Backend Engineering.