60 lines
		
	
	
		
			848 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			848 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | |
| id: cf1111c1c11feddfaeb6bdef
 | |
| title: 除法运算
 | |
| challengeType: 1
 | |
| videoUrl: 'https://scrimba.com/c/cqkbdAr'
 | |
| forumTopicId: 17566
 | |
| dashedName: divide-one-number-by-another-with-javascript
 | |
| ---
 | |
| 
 | |
| # --description--
 | |
| 
 | |
| 我们可以在 JavaScript 中做除法运算。
 | |
| 
 | |
| JavaScript 中使用 `/` 符号做除法运算。
 | |
| 
 | |
| **示例**
 | |
| 
 | |
| ```js
 | |
| const myVar = 16 / 2;
 | |
| ```
 | |
| 
 | |
| 现在,变量 `myVar` 的值为 `8`。
 | |
| # --instructions--
 | |
| 
 | |
| 改变数值 `0` 来让变量 `quotient` 的值等于 `2`。
 | |
| 
 | |
| # --hints--
 | |
| 
 | |
| 要使 `quotient` 的值等于 2。
 | |
| 
 | |
| ```js
 | |
| assert(quotient === 2);
 | |
| ```
 | |
| 
 | |
| 使用 `/` 运算符。
 | |
| 
 | |
| ```js
 | |
| assert(/\d+\s*\/\s*\d+/.test(code));
 | |
| ```
 | |
| 
 | |
| # --seed--
 | |
| 
 | |
| ## --after-user-code--
 | |
| 
 | |
| ```js
 | |
| (function(z){return 'quotient = '+z;})(quotient);
 | |
| ```
 | |
| 
 | |
| ## --seed-contents--
 | |
| 
 | |
| ```js
 | |
| const quotient = 66 / 0;
 | |
| ```
 | |
| 
 | |
| # --solutions--
 | |
| 
 | |
| ```js
 | |
| const quotient = 66 / 33;
 | |
| ```
 |