SnIPPETsX

SnIPPETsX › calculator

calculator

JavaScript · updated Oct 14, 2026 · 23 lines

main.js

//calculator

// define 2 variables
// name as num1 and num2 
// no need to taake input keep the values hardcoded


// take a variable operation
// no input to be taken value to be hardcoded


// now write 5 if-else statments


//1. Addition

//2. Subtraction

//3. Multiplication

//4. Division

//5. EXIT 

Run this JavaScript snippet

Open this snippet on SnIPPETsX to run the JavaScript code in your browser, edit it together with others in real time, or fork it into your own copy. No install or account is needed.