Skip to content

Instantly share code, notes, and snippets.



Last active Jan 30, 2018
What would you like to do?
import {Calculator} from "./src/calculator";
import {getWelcomeMessage} from "./src/welcome";
//invoking the static add() method
let addition = Calculator.add(10, 20);
//invoking the non-static multiply() method
let multiplication = new Calculator().multiply(20, 5);
document.getElementById("welcome-text").textContent = getWelcomeMessage("chahturanga");
document.getElementById("calculator-text").textContent = " (10 + 20 = [" + addition + "]) and (20 * 5 = [" + multiplication + "])";
//Calculator class is assigned to window. so this class can be accessed from browser
window.Calculator = Calculator;
//getWelcomeMessage function is assigned to window. so the function can be accessed from browser
window.getWelcomeMessage = getWelcomeMessage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.