- Join over
**1.5M+ people** - Join over
**100K+ communities** - Free
**without limits** - Create
**your own community**

- You need to write a function, which will take string encoded with
*Caesar cipher*as a parameter and decode it. - The one used here is ROT13 where the value of the letter is

shifted by 13 places.

e.g. 'A' ↔ 'N', 'T' ↔ 'G'. - You have to shift it back 13 positions, such that 'N' ↔ 'A'.

`hint [1/8]`

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [2/8]`

This can be a tricky problem to understand. You need to find where in the array a number should be inserted by order, and return the index where it should go.

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [3/8]`

The first thing to do is sort the array from lower to bigger, just to make the code easier. This is where sort comes in, it needs a callback function so you have to create it.

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [4/8]`

Once the array is sorted, then just check for the first number that is bigger and return the index.

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [5/8]`

If there is no index for that number then you will have to deal with that case too.

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [6/8]`

**Solution ahead!**

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

wait thats not even the right puzzle

wtf

`hint [1/8]`

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [2/8]`

This can be a tricky problem to understand. You need to find where in the array a number should be inserted by order, and return the index where it should go.

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [3/8]`

The first thing to do is sort the array from lower to bigger, just to make the code easier. This is where sort comes in, it needs a callback function so you have to create it.

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [4/8]`

Once the array is sorted, then just check for the first number that is bigger and return the index.

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [5/8]`

If there is no index for that number then you will have to deal with that case too.

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [6/8]`

**Solution ahead!**

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [7/8]`

```
function where(arr, num) {
arr.sort(function(a, b) {
return a - b;
});
for (var a = 0; a < arr.length; a++) {
if (arr[a] >= num)
return parseInt(a);
}
return arr.length;
}
```

- First I sort the array using
`.sort(callbackFuntion)`

to sort it by lowest to highest, from left to right. - Then I use a for loop to compare the items in the array starting from the smallest one. When an item on the array is greater than the number we are comparing against, then we return the index as an integer.

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [8/8]`

```
function where(arr, num) {
arr.push(num);
arr.sort(function(a, b)
{return a-b;}
);
return arr.indexOf(num);
}
```

- First insert the number into the array using the
`Array.push()`

method. - Then use the numerical sort method to sort the elements of the array. in the end just return the index value of the number that was push earlier using the
`Array.indexOf()`

method.

If you found this page useful, you can give thanks by copying and pasting this on the main chat: `Thanks @Rafase282 and @rahul1992 for your help with Bonfire: Where do I belong`

NOTE:Please add your username only if you have added anyrelevant main contentsto the wiki page. (Please don't remove any existing usernames.)type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

`hint [1/1]`

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

```
function where(arr, num) {
// Find my place in this sorted array.
return num;
}
where([40, 60], 50);
```

Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).

more info:

`bf details`

|`bf links`

|`hint`

`hint [1/1]`

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]

@Yulin777

hey fellas can you help me find why my code work partially for the bonfire "Where do I belong"

```
function getIndexToIns(arr, num) {
// Find my place in this sorted array.
var array = arr.sort();
for (var i=0 ; i<array.length ; i++){
if ((num >= array[i]) && (num <= array[i+1]))
{
if (num == array[i])
return i;
return i+1;
}
}
}
getIndexToIns([40, 60], 50);
```

Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted. The returned value should be a number.

For example, getIndexToIns([1,2,3,4], 1.5) should return 1 because it is greater than 1 (index 0), but less than 2 (index 1).

Likewise, getIndexToIns([20,3,5], 19) should return 2 because once the array has been sorted it will look like [3,5,20] and 19 is less than 20 (index 2) and greater than 5 (index 1).

Remember to use Read-Search-Ask if you get stuck. Write your own code.

Here are some helpful links:

```
function getIndexToIns(arr, num) {
// Find my place in this sorted array.
var array = arr.sort();
for(var i = 0; i < arr.length; i++) {
if(num > array[i] && num < array[i + 1]) {
return array.indexOf(i + 1) + 1;
} else if (num == array[i]) {
return array.indexOf(i) + 1;
}
}
}
getIndexToIns([40, 60], 50);
```

help needed here.
hint

`hint [1/1]`

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type

`hint`

for next hint :pencil: [Contribute at the FCC Wiki]