Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forumguidelines
Bria Collins
2k
2
150
Javascript using function with parameters, and return statement
Jan 22 2021 1:11 AM
<html>
<body>
<script>
let a = window.prompt("Enter a number: ");
let num = parseInt(window.prompt("Enter a number: "));
let num2 = parseInt(window.prompt("Enter a number: "));
function calc(val){
switch (a)
{
case '+':
return num+num2;
break;
case '-':
result = num1 - num2;
document.write("Difference is: " + result);
break;
case '*':
result = num1 * num2;
document.write("Product is: " + result);
break;
case '/':
result = num1 / num2;
document.write("Quotient is: " + result);
break;
default:
document.write("Error! operator is not correct");
break;
}
}
</script>
</body>
</html
Reply
Answers (
2
)
How to convert string to Base64 in angular?
Align the label in center position in google map