+ 2
I will include a code that has some user input included. Try inserting this code into your JS file or if using the SoloLearn Code Playground, under the JS tab:
function onClick() {
alert("Welcome to my code!");
var country = confirm("Do you love your country?");
if(country === true) {
alert("I love my country!");
}else {
alert("No, I do not love my country.");
}
}
The above code is the JS code. Here is the HTML code that will be needed:
<!DOCTYPE html>
<html>
<head>
<title>Insert Your Page Title</title>
</head>
<body>
<input type = "button" value = "Click me" onClick = "onClick()"/>
</body>
</html>
I really hope this helps you, happy coding!