Count the Arguments

Published by Theldoria in

Create a function that returns the number of arguments it was called with.

Examples

numArgs() ➞ 0

numArgs("foo") ➞ 1

numArgs("foo", "bar") ➞ 2

numArgs(foo: 1, bar: 2) ➞ 2

numArgs() {} ➞ 1

Notes

  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.
Watch a quick demo on how Edabit works.