JavaScript data-types

JavaScript is a versatile language that's used in programming everything from web pages to servers and desktop applications. We will use this interactive tutorial as a reference in our journey.

JavaScript is different from the other languages we've seen here (C++, C#, Java), in that it doesn't have a compiler. The code is interpreted while running it.

This brings us to a distinction in data-types as well. JavaScript doesn't fix the type of its variables. For example, this is a valid sequence for the interpreter:

var x;           // x is undefined to start with
x = 15;          // After this assignment, x is a Number
x = "Phil";      // Here x becomes a String

Many other fun things can happen with JavaScript data, as you can see here.

What could be the use of such flexibility? Tell us what you feel below.
Hint: Think of real-life arrays - like array of vehicles, array of chat messages, etc.

Once you are done, let's step into functions, the core of JavaScript.

Comments

  1. An array of vehicles is heterogeneous - each element can be a different vehicle. But an array normally holds many elements of one type. Can we have heterogeneous arrays?

    ReplyDelete
  2. Yes we can have heterogeneous arrays in javascript. since we can store different data type elements in an array like string , number, boolean can be store in a single array.

    ReplyDelete
    Replies
    1. Definitely! But wouldn't that be hard to read? How will a reader of the data know if an element is a string, number or boolean?
      Or do they need to know?...

      Delete
  3. Best bets for soccer today - Sports Toto
    Today, we're going to tell you a few key to checking into soccer gri-go.com betting nba매니아 apps. หารายได้เสริม of the most popular soccer betting 토토 사이트 추천 options and which ones will febcasino.com

    ReplyDelete

Post a Comment

Popular posts from this blog

Relationships in a Relational Database

Data Schema and Blobs