How it feels to learn JavaScript
  • How it feels to learn JS
  • Table of Contents
  • Introduction
    • Is EcmaScript is JavaScript? TC39
  • JS Basics
    • Basic Concepts
    • Objects
    • Function vs Method
      • Anonymous Function
    • Scopes and keyword "this"
    • Prototypical
  • Dependencies / Packages Management
    • Chapter: Dependencies / Package Management
    • NPM
    • Bower
  • JS-Engines
    • Browser vs Node.js
  • Super / Sub - Lang
    • Chapter: Super / Sub Languages
    • TypeScript
      • Architectural Overview
  • Framework / Library
    • Angular
      • Bootstrapping
      • Change Detection
      • Singleton Services
    • React
  • Paradigms
    • Reactive
      • Rx.js
  • Web API's
    • Web Sockets
    • Web Worker
    • Service Worker
  • Testing
    • Testing Essentials
  • Patterns
    • IIFE (Immediately Invoked Function Expression)
Powered by GitBook
On this page
  1. JS Basics

Basic Concepts

PreviousIs EcmaScript is JavaScript? TC39NextObjects

Last updated 6 years ago

Understanding the Basic

Let's begin with understanding basic concepts of JavaScript.

Variables: number, string, boolean, null, undefined, objects.

To define a variable of any type use keyword.

var nameOfVariable = (assignment operator) Value ;

(; is must. Chrome, Firefox understand your emotions & ignores bad habit missing ; for testing purpose)

This is different from strongly-typed programming languages liked C, C++ or Java. Where the type-checking at compile time as opposed to dynamically typed languages (run-time checking) like JavaScript as shown in the above figure using Chrome V8 run-time. I would highly recommend to try this examples in your browser console.

var a = 5;

<- undefined; (return type)

Value return by run-time is of type undefined.While in-case of using operator typeof(argument)returns string "number".Declaration of a variable does not return any value that is why it returned with type undefined.Evaluated variable does not have a assigned value or defined return type; then it will return undefined.

You can override the value with any type of variable type. This seems bit odd and sounds type unsafe while working with a large code base. Usingvarkeyword again would define a new variable in the memory space. Browser gives the intellisense about available properties and methods as shown in the figure.