6 kyu
Emotional Sort ( ︶︿︶)
1,392 of 3,025Phares
Description:
Emotional Sort ( ︶︿︶)
You'll have to create a function that will return an array of emotions sorted. It has two parameters, the first parameter called will expect an array of emotions where an emotion will be one of the following:
- :D -> Super Happy
- :) -> Happy
- :| -> Normal
- :( -> Sad
- T_T -> Super Sad
Example of the array:[ "T_T", ":D", ":|", ":)", ":(" ]
And the second parameter will expect a boolean. If this parameter is true then the order of the emotions will be descending (from Super Happy to Super Sad) if it's false then it will be ascending (from Super Sad to Super Happy)
Example if order is true with the above array: [ ":D", ":)", ":|", ":(", "T_T" ]
- Super Happy -> Happy -> Normal -> Sad -> Super Sad
If order is false: [ "T_T", ":(", ":|", ":)", ":D" ]
- Super Sad -> Sad -> Normal -> Happy -> Super Happy
Example:
array: [":D", ":|", ":)", ":(", ":D"]
order: true
should return [ ":D", ":D", ":)", ":|", ":(" ]
array: [":D", ":|", ":)", ":(", ":D"]
order: false
should return [ ":(", ":|", ":)", ":D", ":D" ]
More in test cases!
Notes:
- The array could be empty, in that case return the same empty array ¯\_( ツ )_/¯
- All emotions will be valid
Enjoy! (づ。◕‿‿◕。)づ
Arrays
Fundamentals
Sorting
Similar Kata:
Stats:
Created | Feb 15, 2018 |
Published | Feb 15, 2018 |
Warriors Trained | 4508 |
Total Skips | 69 |
Total Code Submissions | 6362 |
Total Times Completed | 3025 |
JavaScript Completions | 1392 |
Ruby Completions | 114 |
Python Completions | 1312 |
Elixir Completions | 28 |
Factor Completions | 8 |
Java Completions | 241 |
Lua Completions | 8 |
Total Stars | 79 |
% of votes with a positive feedback rating | 95% of 489 |
Total "Very Satisfied" Votes | 448 |
Total "Somewhat Satisfied" Votes | 37 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 9 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |