/algo

algos

Primary LanguageCSS

A collection of algorythms

  1. checkYuGiOh

This function (named "checkYuGiOh") takes a number, n, as an argument, creates an array of numbers from 1 to n and replaces multiples of 2, 3, and 5 with "yu", "gi" and "oh", then returns the resulting array.

Note:

  • for numbers that have multiple factors, use hyphens as separators e.g 10 === "yu-oh", 30 === "yu-gi-oh"
  • perform checks on your input and return invalid parameter: ${parameter} if an invalid parameter - i.e. a string that can't be converted to a number or another data type - is passed. @param {number} n Number of items in te array to be created @name checkYuGiOh @returns {(string|number)[]} An array of strings and numbers