TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
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
Forums
Monthly Leaders
Forum guidelines
Bria Collins
NA
2
499
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?
Website CMS & Hosting