0

What is wrong with this Javascript code? I get this Uncaught ReferenceError: dollarkoers is not defined Line: 8 as error

<!DOCTYPE html> <!--Opdracht 59, 61, 63 hoofdstuk 2--> <html lang="nl"> <head> <meta http-equiv="Content-Type" content="tekst/html; charset=UTF-8"> <script src="mijnfunctions.js"></script> <script> function afmelden() { var antwoord = confirm("Wilt u zich afmelden?"); if (antwoord === true) { alert("U wordt afgemeld!!!"); window.close(); } } function dollarKoers() { return (1.36); } function euroKoers() { return (0.74); } </script> <title>mijn functies</title> <script> function verdubbel(inputgetal) { outputgetal = inputgetal * 2; return (outputgetal); } </script> </head> <body> <script> mijngetal = prompt("7"); resultaat = verdubbel (mijngetal); document.write("<br>Input-getal:" + mijngetal); document.write("<br>output-getal:" + resultaat); afmelden(); document.write('<br />De dollar koers is ' + dollarkoers()); document.write('<br />De euro koers is ' + eurokoers()); </script> </body> </html>

1st Apr 2020, 12:50 PM
Rinish Harpal
Rinish Harpal - avatar
2 Réponses
+ 2
Remove irrelevant tag from question and add html css js. Don't type code in description. Link it 🔗 https://www.sololearn.com/post/75089/?ref=app
1st Apr 2020, 1:12 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
1> you must enclose the first part of your js code in a <script></script> (from just before "function afmelden(){" to just before "<title>mijn functies</title>" 2> identifiers are case sensitive (wether lower/uppercase are considererd equal or not), so 'a' != 'A', and you must choose if you name your functions "dollarKoers" and "euroKoers", or "dollarkoers" and "eurokoers", but not mix both spelling for reference the same variable / function
1st Apr 2020, 2:01 PM
visph
visph - avatar