6 kyu

range `literals`

Description:

Your function should do this:

// make an array from 0 to 5
range`5` // => [0, 1, 2, 3, 4, 5]

// make an array from 10 to 15
range`10:15` // => [10, 11, 12, 13, 14, 15]

// can be filterred
range`1:50${x => x%10 === 0}` // => [10, 20, 30, 40, 50]

and must return [] if it's not valid like these examples:

range`1:` // => [] no end
range`:5` // => [] no start
range`1:5${true}` // => [] must be a function
range`1 : 10${x => x%2===0}` // => [] contains spaces
range`1:10${()=> true}${()=> true}` // => [] multiple functions

Note:

For range`n:m`, it'll always be 0 <= n < m

Language Features

Similar Kata:

Stats:

CreatedJan 29, 2024
PublishedJan 29, 2024
Warriors Trained177
Total Skips2
Total Code Submissions357
Total Times Completed61
JavaScript Completions61
Total Stars6
% of votes with a positive feedback rating85% of 24
Total "Very Satisfied" Votes18
Total "Somewhat Satisfied" Votes5
Total "Not Satisfied" Votes1
Total Rank Assessments13
Average Assessed Rank
6 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • Rizwanelansyah Avatar
  • Mednoob Avatar
  • XoRMiAS Avatar
Ad