---
title: Vector cross product
id: 594810f028c0303b75339ad2
challengeType: 5
---
## Description
A vector is defined as having three dimensions as being represented by an ordered collection of three numbers: (X, Y, Z).
## Instructions
Write a function that takes two vectors (arrays) as input and computes their cross product. Your function should return null on invalid inputs such as vectors of different lengths.
## Tests
```yml
tests:
- text: dotProduct must be a function
testString: assert.equal(typeof crossProduct, 'function', 'dotProduct must be a function');
- text: dotProduct() must return null
testString: assert.equal(crossProduct(), null, 'dotProduct() must return null');
- text: crossProduct([1, 2, 3], [4, 5, 6]) must return [-3, 6, -3].
testString: assert.deepEqual(res12, exp12, 'crossProduct([1, 2, 3], [4, 5, 6]) must return [-3, 6, -3].');
```
## Challenge Seed
```js
function crossProduct(a, b) {
// Good luck!
}
```