Pigs' houses (string arguments)
The story so far
In the last lesson, we looked at function parameters. Parameters let you reuse a function for different purposes. Check this out:
<button onclick="BetterPiggyBank.addCoin(0.01)" ...
<button onclick="BetterPiggyBank.addCoin(0.05)" ...
<button onclick="BetterPiggyBank.addCoin(0.10)" ...
<button onclick="BetterPiggyBank.addCoin(0.25)" ...
They all call the same function:
BetterPiggyBank.addCoin = function(amount) {
//Do something with amount.
}
Arguments can be strings
amount
is a number. So…
bc.