2021-05-05 10:13:49 -07:00
|
|
|
---
|
|
|
|
id: cf1231c1c11feddfaeb5bdef
|
|
|
|
title: 乘法運算
|
|
|
|
challengeType: 1
|
|
|
|
videoUrl: 'https://scrimba.com/c/cP3y3Aq'
|
|
|
|
forumTopicId: 18243
|
|
|
|
dashedName: multiply-two-numbers-with-javascript
|
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
|
|
|
我們也可在 JavaScript 中使用乘法運算。
|
|
|
|
|
|
|
|
JavaScript 使用 `*` 符號表示兩數相乘。
|
|
|
|
|
|
|
|
**示例**
|
|
|
|
|
|
|
|
```js
|
2021-10-27 15:10:57 +00:00
|
|
|
const myVar = 13 * 13;
|
2021-05-05 10:13:49 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
現在,變量 `myVar` 的值爲 `169`。
|
|
|
|
|
|
|
|
# --instructions--
|
|
|
|
|
2021-05-10 01:12:02 +05:30
|
|
|
改變數值 `0` 來讓變量 product 的值等於`80`。
|
2021-05-05 10:13:49 -07:00
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
|
|
|
變量 `product` 的值應該等於 80。
|
|
|
|
|
|
|
|
```js
|
|
|
|
assert(product === 80);
|
|
|
|
```
|
|
|
|
|
|
|
|
使用 `*` 運算符。
|
|
|
|
|
|
|
|
```js
|
|
|
|
assert(/\*/.test(code));
|
|
|
|
```
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --after-user-code--
|
|
|
|
|
|
|
|
```js
|
|
|
|
(function(z){return 'product = '+z;})(product);
|
|
|
|
```
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```js
|
2021-10-27 15:10:57 +00:00
|
|
|
const product = 8 * 0;
|
2021-05-05 10:13:49 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
```js
|
2021-10-27 15:10:57 +00:00
|
|
|
const product = 8 * 10;
|
2021-05-05 10:13:49 -07:00
|
|
|
```
|