Skip to content

Instantly share code, notes, and snippets.

@petyosi
Created February 9, 2018 14:44
Show Gist options
  • Save petyosi/6879b843d9287b56391bbfd6be489bc6 to your computer and use it in GitHub Desktop.
Save petyosi/6879b843d9287b56391bbfd6be489bc6 to your computer and use it in GitHub Desktop.
import multiply from './multiply';
import sum from './sum';
const totalMultiply = multiply(5, 3);
const totalSum = sum(5, 3);
// create the body
const body = document.createElement("body");
document.documentElement.appendChild(body);
// calculate the product and add it to a span
const multiplyResultsSpan = document.createElement('span');
multiplyResultsSpan.appendChild(document.createTextNode(`Product of 5 and 3 = ${totalMultiply}`));
// calculate the sum and add it to a span
const sumResultSpan = document.createElement('span');
sumResultSpan.appendChild(document.createTextNode(`Sum of 5 and 3 = ${totalSum}`));
// add the results to the page
document.body.appendChild(multiplyResultsSpan);
document.body.appendChild(sumResultSpan);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment