Skip to content

Instantly share code, notes, and snippets.

@04wakeup
Created June 23, 2020 03:10
Show Gist options
  • Save 04wakeup/6dabbcd3685656019b8ed59ec5cb8071 to your computer and use it in GitHub Desktop.
Save 04wakeup/6dabbcd3685656019b8ed59ec5cb8071 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="ES6 in Action: New String Methods [3]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>ES6 in Action: New String Methods</title>
<style>
.income{
color: blue;
}
.moneyFinal{ color: gold; }
#taxes{
color:green;
}
</style>
</head>
<body>
<h1>Income calculator</h1>
<h2 id = "income" class = "income">This is your income<h2>
<button style="button" onclick="addIncome()">Add income</button><br><br>
<button style="button" onclick="calculateTaxes()">Calculate money taxes</button><br><br>
<h2 id="taxes">Taxes you owe</h2>
<h2 id = "result" class="moneyFinal">Money you have left</h2>
<script>
var incomeMoney = 0, taxes = 0.2, taxAmount, incomeFinal;
function addIncome()
{
incomeMoney = incomeMoney + 40000;
document.getElementById('income').innerHTML = "Income for the year $:" + incomeMoney;
}
function calculateTaxes(){
taxAmount = incomeMoney * taxes;
document.getElementById('taxes').innerHTML = "Taxes you owe for the year: $" + taxAmount;
incomeFinal = incomeMoney - taxAmount;
document.getElementById('result').innerHTML = "Your net income after taxes: $" + incomeFinal;
}
</script>
<script id="jsbin-javascript">
"use strict";
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment