chore(i18n,curriculum): processed translations - new ukrainian (#44447)
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
---
|
||||
id: 5a23c84252665b21eecc7e1e
|
||||
title: Скалярний добуток
|
||||
challengeType: 5
|
||||
forumTopicId: 302251
|
||||
dashedName: dot-product
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Створіть функцію, щоб обчислити **[скалярний добуток](https://en.wikipedia.org/wiki/Dot product)**, також відомий як **скалярний продукт** двох векторів.
|
||||
|
||||
# --hints--
|
||||
|
||||
`dotProduct` має бути функцією.
|
||||
|
||||
```js
|
||||
assert(typeof dotProduct == 'function');
|
||||
```
|
||||
|
||||
`dotProduct([1, 3, -5], [4, -2, -1])` має повертатись як число.
|
||||
|
||||
```js
|
||||
assert(typeof dotProduct([1, 3, -5], [4, -2, -1]) == 'number');
|
||||
```
|
||||
|
||||
`dotProduct([1, 3, -5], [4, -2, -1])` має повернути `3`.
|
||||
|
||||
```js
|
||||
assert.equal(dotProduct([1, 3, -5], [4, -2, -1]), 3);
|
||||
```
|
||||
|
||||
`dotProduct([1, 2, 3, 4, 5], [6, 7, 8, 9, 10])` має повернути `130`.
|
||||
|
||||
```js
|
||||
assert.equal(dotProduct([1, 2, 3, 4, 5], [6, 7, 8, 9, 10]), 130);
|
||||
```
|
||||
|
||||
`dotProduct([5, 4, 3, 2], [7, 8, 9, 6])` має повернути `106`.
|
||||
|
||||
```js
|
||||
assert.equal(dotProduct([5, 4, 3, 2], [7, 8, 9, 6]), 106);
|
||||
```
|
||||
|
||||
`dotProduct([-5, 4, -3, 2], [-7, -8, 9, -6])` має повернути `-36`.
|
||||
|
||||
```js
|
||||
assert.equal(dotProduct([-5, 4, -3, 2], [-7, -8, 9, -6]), -36);
|
||||
```
|
||||
|
||||
`dotProduct([17, 27, 34, 43, 15], [62, 73, 48, 95, 110])` має повернути `10392`.
|
||||
|
||||
```js
|
||||
assert.equal(dotProduct([17, 27, 34, 43, 15], [62, 73, 48, 95, 110]), 10392);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function dotProduct(ary1, ary2) {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function dotProduct(ary1, ary2) {
|
||||
var dotprod = 0;
|
||||
for (var i = 0; i < ary1.length; i++) dotprod += ary1[i] * ary2[i];
|
||||
return dotprod;
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user