String conversion
String conversion happens when we need the string form of a value.
For example, alert(value) does it to show the value.
We can also call the String(value) function to convert a value to a string:
let value = true;
alert(typeof value); // boolean
value = String(value); // now value is a string "true"
alert(typeof value); // string
Script tag
We can use a <script> tag to add JavaScript code to a page.
The type and language attributes are not required.
A script in an external file can be inserted with <script src="path/to/script.js"></script>.
Unary operator
The plus + exists in two forms: the binary form that we used above and the unary form.
The unary plus or, in other words, the plus operator + applied to a single value, doesn’t do anything to numbers. But if the operand is not a number, the unary plus converts it into a number.
// No effect on numbers
let x = 1;
alert( +x ); // 1
let y = -2;
...
An introduction to git and Github for beginners
if you’re new to git, follow the steps below to get comfortable making changes to the code base, opening up a pull request (PR), and merging code into the master branch.
Introduction
Git is a version control system for tracking changes in the code. Git is the software or tool on which Github is built. You can use git and never use github and vi...
Use strict mode
The “use strict” directive switches the engine to the “modern” mode, changing the behavior of some built-in features. We’ll see the details later in the tutorial.
Strict mode is enabled by placing “use strict” at the top of a script or function. Several language features, like “classes” and “modules”, enable strict mode automatically.
Strict mod...
Prefix and Postfix increment
The operators ++ and – can be placed either before or after a variable.
When the operator goes after the variable, it is in “postfix form”: counter++.
The “prefix form” is when the operator goes before the variable: ++counter.
Both of these statements do the same thing: increase counter by 1.
Is there any difference? Yes, but we can only see i...
Data types in Javascript
There are 8 basic data types in JavaScript.
number for numbers of any kind: integer or floating-point, integers are limited by ±253.
bigint is for integer numbers of arbitrary length.
string for strings. A string may have one or more characters, there’s no separate single-character type.
boolean for true/false.
null for unknown values – a stand...
Javascript alternatives
The syntax of JavaScript does not suit everyone’s needs. Different people want different features.
That’s to be expected, because projects and requirements are different for everyone.
So recently a plethora of new languages appeared, which are transpiled (converted) to JavaScript before they run in the browser.
Modern tools make the transpila...
27 post articles, 4 pages.