freeCodeCamp icon indicating copy to clipboard operation
freeCodeCamp copied to clipboard

Waypoint: Filter Arrays with filter GLITCH

Open ghost opened this issue 11 years ago • 6 comments

Challenge Waypoint: Filter Arrays with filter has an issue. User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36. Please describe how to reproduce this issue, and include links to screenshots if possible.

This particular lesson in unresponsive and does not allow me to alter any of the code.

My code:

var oldArray = [1,2,3,4,5,6,7,8,9,10];

// Only change code below this line.

var newArray = oldArray;

 Array = newArray.filter(function(val) {

  return val > 5;

});
// Only change code above this line.

(function() { return newArray; })();

ghost avatar Nov 17 '15 05:11 ghost

We have had various reports of freezing. Were you able to do a hard-refresh to get it going again? Have you checked your dev-console (F12 on most PC browsers) for any error/warning messages?

SaintPeter avatar Nov 17 '15 06:11 SaintPeter

I tried to reset the code with the reset button within the lesson but it does not do anything.

When tapping the F12 key I received these 2 errors:

(1)_____________________________________________________________ jshint.js:17839 Uncaught TypeError: Cannot read property 'slice' of undefined:

} catch (err) { if (err && err.name === "JSHintError") { var nt = state.tokens.next || {}; JSHINT.errors.push({ scope : "(main)", raw : err.raw, code : err.code, reason : err.message, line : err.line || nt.line, character : err.character || nt.from }, null); } else { throw err; **_<--- error was on this line: 17839_

(2)______________________________________________________________ Uncaught TypeError: Cannot read property 'slice' of undefined:

var signal = CodeMirror.signal = function(emitter, type /, values.../) { var arr = emitter.handlers && emitter.handlers[type]; if (!arr) return; var args = Array.prototype.slice.call(arguments, 2); ******<--- error was on this line: 7330 **** for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args); };


ghost avatar Nov 17 '15 07:11 ghost

I completed this area by using safari on my Mac. Not sure why the browser on my PC was causing this.

ghost avatar Nov 17 '15 07:11 ghost

Thanks!

ghost avatar Nov 17 '15 07:11 ghost

@redpill19 thanks for posting this issue! Closing as resolved but feel free to reopen if you still experience problems with this, thanks.


Please review the Guidelines for Contributing, thank you!.


bugron avatar Nov 17 '15 12:11 bugron

OP is assigning filtered array to Array constructor. That may be the cause?

 Array = newArray.filter(function(val) {
  return val > 5;
});

venkatraj avatar Dec 12 '15 10:12 venkatraj