<script type="text/javascript">
function displaymessage() {
let socks = 3
alert(`You have this many socks, plus 6: ${socks +6}`))
}
</script>
<input type="button" value="Click me!" onclick="displaymessage()" >
Also consider replacing onclick with addEventListener
Self-taught designer, developer, and musician. JS, CSS, React, Next, Vue, Node, and much more. Studying computer information systems at Mississippi College.
According to me the code should be -
Also consider replacing
onclick
withaddEventListener
Nice answer, and great job using the variable inside the string! However, you do have an extra parenthesis on line 4. :D
Socks should be a const:)