← Back to challenges

Programming Polyglot

JavaScriptHardnumbersarraysbit_operations

Instructions

Create a function that takes a number that represents a person's programming language score, and returns an alphabetised array of programming languages they are proficient in. Arbitrarily assigned points for each language are listed below:

LanguagePoints
C#1
C++2
Java4
JavaScript8
PHP16
Python32
Ruby64
Swift128

Examples

getLanguages(25) ➞ ["C#", "JavaScript", "PHP"]

getLanguages(100) ➞ ["Java", "Python", "Ruby"]

getLanguages(53) ➞ ["C#", "Java", "PHP", "Python"]

Notes

Easier using bitwise operations.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.