Home  >  Article  >  Web Front-end  >  How to find the total score of three subjects in javascript

How to find the total score of three subjects in javascript

藏色散人
藏色散人Original
2022-01-18 11:31:592406browse

Javascript method to find the total score of the three subjects: 1. Create a js sample file; 2. Find the total score of the three subjects through "var total=result result1 result2;".

How to find the total score of three subjects in javascript

The operating environment of this article: Windows 7 system, javascript version 1.8.5, Dell G3 computer.

javascript How to find the total score of three subjects?

js Enter the scores of three subjects to get the total score

Input js, java, SQL three subject scores, get the total score

Rendering

How to find the total score of three subjects in javascript
How to find the total score of three subjects in javascript
How to find the total score of three subjects in javascript

##js code

<script>
	var grade=prompt(&#39;请输入js成绩:&#39;);
    var grade1=prompt(&#39;请输入Java成绩:&#39;);
	var grade2=prompt(&#39;请输入sql成绩:&#39;);
	var result=parseFloat(grade);
	var result1=parseFloat(grade1);
	var result2=parseFloat(grade2);
	var total=result+result1+result2;
			alert(total);
			</script>

Recommended study: "

js Basic Tutorial"

The above is the detailed content of How to find the total score of three subjects in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn