Created
February 5, 2021 11:25
-
-
Save anandaanv/d9f7cbcc71934a2d10e7b17694a5d54b to your computer and use it in GitHub Desktop.
Whats my proficiency - 5 levels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function whatsMyLevel(scale) { | |
let map = new Map(); | |
map.set('beginner', '0-20'); | |
map.set('familier', '21-50'); | |
map.set('familier', '51-50'); | |
map.set('expert', '71-90'); | |
map.set('guru', '91-99'); | |
let level = "god"; | |
map.forEach( (value, key, map) => { | |
let range = value.split("-"); | |
if(scale >= parseInt(range[0], 10) && scale <= parseInt(range[1], 10)) { | |
level = key; | |
} | |
}); | |
return 'You are ' + level; | |
} | |
// 1. Code RUN automatically: type your name | |
console.log(whatsMyLevel(10)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment