0

What is wrong with this Javascript code? Uncaught SyntaxError: Unexpected token '<' Line: 1

<!DOCTYPE html> <html lang="nl"> <head> </head> <body> <script> function bestelAuto(merk, klasse, kleur) { if (typeof arguments[0] === 'undefined') { // gebruik default waarde merk = 'Audi'; } document.write( '<br>Bestelde: een ' + merk ' ' + klasse + ' in ' + kleur); } bestelAuto(); bestelAuto('Porsche') bestelAuto('Volvo' , 'Klasse A') bestelAuto('BMW' , 'Klasse B' , 'Blauw'); </script> </body> </html>

1st Apr 2020, 7:53 PM
Rinish Harpal
Rinish Harpal - avatar
2 ответов
+ 1
You miss a "+" operator Here is the correct line: document.write('<br>Bestelde: een ' + merk + ' ' + klasse + ' in ' + kleur); Edit: Maybe you put that code in the JS code when you have to put it in the HTML code
1st Apr 2020, 8:04 PM
Raúl
0
Thanks mate it is work now
1st Apr 2020, 9:21 PM
Rinish Harpal
Rinish Harpal - avatar