Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update and rename logarithmCalculator.md to logBase.md
  • Loading branch information
Trinityyi authored Oct 7, 2020
commit 34c921fa4c41b19c9b2b6f7876dcbf45e215672c
17 changes: 17 additions & 0 deletions snippets/logBase.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: logBase
tags: math,beginner
---

Returns the logarithm of the given number in the given base.

- Use `Math.log()` to get the logarithm from the value and the base and divide them.

```js
const logBase = (n, base) => Math.log(n) / Math.log(base);
```

```js
logBase(10, 10); // 1
logBase(100, 10); // 2
```
19 changes: 0 additions & 19 deletions snippets/logarithmCalculator.md

This file was deleted.