Most of the time, operators and functions automatically convert the values given to them to the right type. For example, alert automatically converts any value to a string to show it. Mathematical operations convert values to numbers. There are also cases when Read More …
Month: June 2020
Part – 5: Interaction: alert, prompt, confirm
As we’ll be using the browser as our demo environment, let’s see a couple of functions to interact with the user: alert, prompt and confirm. alert This one we’ve seen already. It shows a message and waits for the user to presses “OK”. For Read More …
Part – 4; Data Types
A value in JavaScript is always of a certain type. For example, a string or a number. There are eight basic data types in JavaScript. Here, we’ll cover them in general and in the next chapters we’ll talk about each Read More …
Part – 3: Variables
Most of the time, a JavaScript application needs to work with information. Here are two examples: An online shop – the information might include goods being sold and a shopping cart.A chat application – the information might include users, messages, Read More …
Part – 2: Syntax
Code structure The first thing we’ll study is the building blocks of code. Statements Statements are syntax constructs and commands that perform actions. We’ve already seen a statement, alert(‘Hello, world!’), which shows the message “Hello, world!”. We can have as many Read More …
Part – 1: Introduction
Hello, world! This part of the tutorial is about core JavaScript, the language itself. But we need a working environment to run our scripts and, since this book is online, the browser is a good choice. We’ll keep the amount Read More …