Where do I Belong // Return in Ternary Operator

Tell us what’s happening:
I want to get in the hang of using one-line if/else statements. I get an error when I use the keyword return in the one-liner. I also know that you can omit the return statement and still be able to return the desired value.

I am aware of scope and that the if/else is within a for loop. Anyway I can return the i index for the function?

Your code so far

function getIndexToIns(arr, num) {
  // Find my place in this sorted array.
  arr.sort((a, b) => a - b)
  console.log(arr) // good
  for(let i in arr){
    console.log(i, arr[i], num) //check index, index in arr, num
    arr[i] === num ? i : 0 

getIndexToIns([40, 60], 50);

Link to the challenge:

I don’t really understand the problem you are trying to describe. What do you mean by “I get an error when I use the keyword return in the one-liner.”? What is the error? What is “the one-liner”?