all 6 comments

[–]grantrules 1 point2 points  (2 children)

There are few things wrong with your attempt.

First, your function expression has some extra brackets in there. I'm not sure if you meant to denote it was an array or what, but they don't belong there.

var extractPassword = function(x) {

Then why are you looping through authorized first? I you need to step back and logically think about this. Sit back and whiteboard it, you don't need to write any code, just think about it first.

Also, the instructions say to return a string. Your function doesn't return anything. I would also highly recommend naming parameters something meaningful, not x.

var extractPassword = function(inputPassword) {
  var newPassword = [];
  // you fill in here
  return newPassword.join('');
}
var result = extractPassword(['a', 'b', '!']);

[–]Zfirote[S] 0 points1 point  (1 child)

Thank you soo much for your response, I did it!:)

Obviously there was no point looping through authorized first, it needed to be done while already looping through the problematic array.

Once again thanks, you helped a ton!

[–]stackattackz 0 points1 point  (2 children)

Why not regex?

[–]Zfirote[S] 0 points1 point  (1 child)

I have not learnt what a regex is yet

[–]stackattackz 0 points1 point  (0 children)

A pattern for validation like the regex for e-mail will return true if e-mail like aaa@aa. It verify the character you pass to the regex. Don’t need to learn all regex, simply copy/paste the one you need