5 kyu

Even or Odd Accessor 2 : Electric Boogaloo

31 of 34JavaScripts

Description:

Create a function that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers. The function should also return "Even" or "Odd" when accessing a value at an integer index. Also this function should evaluate the same when instantiated as an object using the new keyword.

For example:

evenOrOdd(2); //'Even'
evenOrOdd[2]; //'Even'
new evenOrOdd(2); //'Even'
new evenOrOdd[2]; //'Even'
evenOrOdd(7); //'Odd'
evenOrOdd[7]; //'Odd'
new evenOrOdd(7); //'Odd'
new evenOrOdd[7]; //'Odd'
Language Features

More By Author:

Check out these other kata created by JavaScripts

Stats:

CreatedJun 2, 2024
PublishedJun 2, 2024
Warriors Trained467
Total Skips31
Total Code Submissions262
Total Times Completed34
JavaScript Completions31
TypeScript Completions6
CoffeeScript Completions3
Total Stars14
% of votes with a positive feedback rating97% of 16
Total "Very Satisfied" Votes15
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes0
Total Rank Assessments7
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
5 kyu
Ad
Contributors
  • JavaScripts Avatar
  • JohanWiltink Avatar
Ad