Course offer · HLD · LLD · System Design at ₹799 until 30 Nov (not interview packs)

ProgramsJavaScript

JavaScript Basic Programs

Start here with simple JavaScript programs. Print text, add numbers, swap values and convert units. Each page explains the code line by line and shows the output.

10 programs · open one, then the next

Start with Hello World
  1. 01Hello WorldBeginnerWrite a Hello World program in JavaScript with one console.log line. Simple explanation, how to run it in Node or the browser, and the exact output shown.Open example →
  2. 02Display Your NameBeginnerDisplay your name in JavaScript using a let variable and console.log with two values. Clear explanation of let, const and var, plus the exact output.Open example →
  3. 03User InputBeginnerRead user input in JavaScript with prompt() and print a greeting. Learn why prompt returns a string and why Node has no prompt, with explanation and output.Open example →
  4. 04Sum of Two NumbersBeginnerAdd two numbers in JavaScript and print the sum. Learn why "10" + "20" gives 1020 and how Number() and parseInt() differ, with explanation and output.Open example →
  5. 05Swap Two NumbersBeginnerSwap two numbers in JavaScript three ways: a temp variable, array destructuring and arithmetic. Each method has an explanation and before and after output.Open example →
  6. 06JavaScript Data TypesBeginnerLearn JavaScript data types with typeof: number, string, boolean, null, undefined, symbol, bigint and objects. Clear explanation of each and the output.Open example →
  7. 07Arithmetic OperationsBeginnerJavaScript arithmetic operators + - * / % ** and ++/--. Learn why ^ is not power and how to divide whole numbers, with a simple explanation and output.Open example →
  8. 08Convert Fahrenheit to CelsiusBeginnerConvert Fahrenheit to Celsius in JavaScript with C = (F - 32) * 5 / 9. Includes a reusable function and toFixed rounding, with explanation and output.Open example →
  9. 09Calculate Simple InterestBeginnerCalculate simple interest in JavaScript with SI = P × R × T / 100. Learn why rate 5 means 5 percent and return an object, with explanation and output.Open example →
  10. 10Area and Perimeter of RectangleBeginnerFind the area and perimeter of a rectangle in JavaScript. Learn length × width and 2 × (length + width) using functions, with explanation and output.Open example →