Last active
January 30, 2018 08:10
-
-
Save chathurangat/e82df30b7e8a525bcac4ce4a41892ca5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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