Tell us what’s happening:
Trying to print
Describe your issue in detail here.
I am trying to print out variable to check where my code is not working. When I enter, “System.out.println” I get and error reported. The error is"ReferenceError: System is not defined". How can I check for the problem if the program won’t let me inspect the items?
Your code so far
function getIndexToIns(arr, num) {
arr.sort();
for(let i = 0; i < arr.length; i++){
if(arr[i] > num){
arr.splice(i,0,num);
return arr.indexOf(num);
}
}
}
System.out.println(i)
getIndexToIns([40, 60], 50);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
Challenge: Basic Algorithm Scripting - Where do I Belong
Link to the challenge: