---
id: 6a1d9f98e819ed70a0e994dd
title: "Challenge 331: Nearest Multiple"
challengeType: 28
dashedName: challenge-331
---

# --description--

Given two integers, round the first to the nearest multiple of the second.

# --hints--

`roundToNearestMultiple(5, 3)` should return `6`.

```js
assert.equal(roundToNearestMultiple(5, 3), 6);
```

`roundToNearestMultiple(17, 4)` should return `16`.

```js
assert.equal(roundToNearestMultiple(17, 4), 16);
```

`roundToNearestMultiple(43, 5)` should return `45`.

```js
assert.equal(roundToNearestMultiple(43, 5), 45);
```

`roundToNearestMultiple(38, 11)` should return `33`.

```js
assert.equal(roundToNearestMultiple(38, 11), 33);
```

`roundToNearestMultiple(93, 12)` should return `96`.

```js
assert.equal(roundToNearestMultiple(93, 12), 96);
```

# --seed--

## --seed-contents--

```js
function roundToNearestMultiple(num, multiple) {

  return num;
}
```

# --solutions--

```js
function roundToNearestMultiple(num, multiple) {
  return Math.round(num / multiple) * multiple;
}
```
