**Tell us what’s happening:**

**Your code so far**

```
function largestPrimeFactor(number) {
// Good luck!
let j=[];
for(var i=2;i<=number;i++){
if(number%i===0)
j.push(i);
}
var counter;
for(var k=0;k<j.length;k++){
for(counter=2;counter<=j[k]/2;counter++){
if(j[k]%counter===0){
var index = j.indexOf(j[k]);
if(index > -1) {
j.splice(index, 1);
}
}
}
}
var lastItem = j.pop();
return lastItem;
}
largestPrimeFactor(13195);
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36`

.

**Link to the challenge:**

https://learn.freecodecamp.org/coding-interview-prep/project-euler/problem-3-largest-prime-factor