Hello World
JavaScript, often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS.
If you want to be a web developer, JavaScript is a must.
Let's start with a classic "Hello World".
console.log('Hello World!')
The console
object provides access to the debugging console. And console.log()
is used for general output of logging information.
Comments
Similar to C, JavaScript has 2 types of comments.
/*
This is a block comment.
*/
// This is a line comment.
Comments are used to write programmers' notes that is to be ignored by the compiler or interpreter.
As you see there, a line comment starts with double slashes //
, and a block one is wrapped by /* ... */
.
Template Literals
Template literals are literals delimited with backtick (`
) characters, allowing for multi-line strings, string interpolation with embedded expressions.
let a = 10;
let b = 32;
console.log(`Hello, ${a+b}.`) // Hello, 42.
Code Challenge
Try to modify the code provided in the editor to make it print
Hello, JavaScript! I'm doing web now!
.