Hey, guys and gals, I was just wondering if you could offer any tips with this code! I know it’s super bad because I feel like I brute forced the answer. I didn’t look anything up besides the documentation examples of course since I’m trying my best to think on my own. I have to admit that I’m struggling a bit with these “basic” challenges, haha!
function getIndexToIns(arr, num) {
var args = Array.prototype.slice.call(arguments);
var newArray = args.toString().split(',');
newArray.sort(function(a,b) {
return a - b;
});
function butWhy(element) {
return element == num;
}
return newArray.findIndex(butWhy);
}