Skip to content

Instantly share code, notes, and snippets.

@anandaanv
Created February 5, 2021 11:25
Show Gist options
  • Save anandaanv/d9f7cbcc71934a2d10e7b17694a5d54b to your computer and use it in GitHub Desktop.
Save anandaanv/d9f7cbcc71934a2d10e7b17694a5d54b to your computer and use it in GitHub Desktop.
Whats my proficiency - 5 levels
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