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

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

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

even(100) ➞ 198

Notes

N/A

Watch a quick demo on how Edabit works.