Nth Even Number

Published by Mubashir Hassan in

Create a function that takes a number n and returns the nth even number beginning with 0 as the first.

Examples

nthEven(1) ➞ 0
// 0 is first even number

nthEven(2) ➞ 2
// 2 is second even number

nthEven(100) ➞ 198

Notes

N/A

Watch a quick demo on how Edabit works.