JavaScript Basics - Exercise 3

Start the counter at 0 and use the prefix increment operator inside the loop. The condition allows the loop to reach 10, while ++num increments before printing.

javascript

let num = 0;
while(num <= 10) {
  console.log(++num);
}

Start at 10 and keep looping while the counter is at least 1. The postfix decrement prints the current value first, then subtracts one for the next iteration.

javascript

let num = 10;
while(num >= 1) {
  console.log(num--);
}

javascript

//Account Details of my account
const accountNumber = 546565;
let ifscCode = "KOTAK565612";
var accoutHolderName = "Simply JavaScript";
let balance = 87000;
let bankAddress = "Queens Road, Delhi";  

javascript

/*
  Below code is used to print numbers from 1 to 10
*/
console.log(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);  

A process represents a running instance of a program, while a thread is an individual execution unit within that process. Threads share the same memory space within a process and can communicate directly, whereas processes have separate memory spaces and need inter-process communication mechanisms to communicate. In essence, processes encapsulate programs in execution, while threads represent independent execution sequences within those processes.

A process is a running program with its own memory, while a thread is an execution path inside that process. Threads in one process share memory, so they communicate cheaply but must coordinate shared state carefully.

console.log("The browser process can run many tasks");
console.log("JavaScript usually executes code on one main thread");

javascript

console.log(1 + 1);
console.log(1 + 200);
console.log(200 + "300");
console.log("learnjavascript" + 400);  

JavaScript is a programming language that is primarily used to create interactive and dynamic web pages. It is a client-side scripting language, which means that it runs directly in the web browser, rather than on a server. JavaScript allows developers to create a wide range of interactive elements on web pages, such as form validation, image sliders, and interactive maps. It can also be used to create browser-based games and desktop applications using technologies such as Electron and Node.js. JavaScript code is usually written in a text editor and then embedded in an HTML or PHP file, which is then run in a web browser. JavaScript is also often used in combination with other technologies such as HTML, CSS, and web frameworks such as Angular, React, and Vue.js.

javascript

console.log(2 ** 4); // 16
                        console.log(14 % 10); // 4
                        console.log(5 != "5"); // false
                        console.log(5 !== "5"); // true
                        console.log(10 <= 5); // false
                        console.log(10 >= 10); // true

When either operand is a string, the + operator concatenates values from left to right instead of adding them numerically.

javascript

console.log("Total: " + 2 + 3); // Total: 23
console.log(2 + 3 + " items"); // 5 items