2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
id: cf1231c1c11feddfaeb5bdef
|
2020-12-16 00:37:30 -07:00
|
|
|
title: 乘法运算
|
2018-10-10 18:03:03 -04:00
|
|
|
challengeType: 1
|
2020-04-29 18:29:13 +08:00
|
|
|
videoUrl: 'https://scrimba.com/c/cP3y3Aq'
|
|
|
|
forumTopicId: 18243
|
2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --description--
|
|
|
|
|
2020-04-29 18:29:13 +08:00
|
|
|
我们也可在 JavaScript 中使用乘法运算。
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
JavaScript 使用`*`符号表示两数相乘。
|
|
|
|
|
|
|
|
**示例**
|
2020-04-29 18:29:13 +08:00
|
|
|
|
|
|
|
```js
|
|
|
|
myVar = 13 * 13; // assigned 169
|
|
|
|
```
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --instructions--
|
2020-04-29 18:29:13 +08:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
改变数值`0`来让变量 product 的值等于`80`。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --hints--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
要使`product`的值等于 80。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
```js
|
2020-12-16 00:37:30 -07:00
|
|
|
assert(product === 80);
|
2018-10-10 18:03:03 -04:00
|
|
|
```
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
使用`*`运算符。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
```js
|
2020-12-16 00:37:30 -07:00
|
|
|
assert(/\*/.test(code));
|
2018-10-10 18:03:03 -04:00
|
|
|
```
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --solutions--
|
2020-04-29 18:29:13 +08:00
|
|
|
|