Skip to content

Instantly share code, notes, and snippets.

@misostack
Last active January 5, 2021 09:34
Show Gist options
  • Select an option

  • Save misostack/f41fe98b09a292d9b87703288f22358d to your computer and use it in GitHub Desktop.

Select an option

Save misostack/f41fe98b09a292d9b87703288f22358d to your computer and use it in GitHub Desktop.
Testcases
<button id="click">Click</button>
<p>Click Count: <span style="font-weight:bold;" id="count"></span></p>
<p>SUM: <span style="font-weight:bold;" id="sum"></span></p>
const btn = document.getElementById('click');
const countEle = document.getElementById('count');
const sumEle = document.getElementById('sum');
let sum = 0;
let count = 0;
const MAX = 1e9;
const updateSUM = () => {
	sumEle.innerHTML = sum;
}
const updateClickCount = () => {
	count += 1;
  console.log(count);
  countEle.innerHTML = count;
}

const sumFrom1ToMax = () => {
  // write your code here
  updateSUM();
}

btn.onclick = async (e) => {
	console.log('click');	
	updateClickCount();
  sumFrom1ToMax();
}
@misostack

Copy link
Copy Markdown
Author

tc1-dapap

@misostack

Copy link
Copy Markdown
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment