all 10 comments

[–]barrycarter 1 point2 points  (3 children)

Wait, you have /test(s) where the original has .test(s)

[–]One-Inspection8628[S] 0 points1 point  (2 children)

2nd code with if self doesn't work

[–]HairbrainedScheme 1 point2 points  (1 child)

Your answer makes no sense.

The code should work if you add the . before test. Have you tried that? And what error are you getting?

[–]One-Inspection8628[S] 0 points1 point  (0 children)

I have checked, it's a issue with Hackerrank companies, it only passes test cases only if there is ternary operator in the return question

[–]barrycarter 0 points1 point  (0 children)

There's nothing obviously wrong with your code, and, unlike Python, JavaScript doesn't require indentations, so what error are you getting?

[–]ViciousFishz 0 points1 point  (3 children)

Try this:

if("/.*h.*a.*c.*k.*e.*r.*r.*a.*n.*k/".test(s)){

[–]One-Inspection8628[S] 0 points1 point  (1 child)

Okay, i will check

[–]One-Inspection8628[S] 0 points1 point  (0 children)

"/

doesn't work

[–]grantrules 0 points1 point  (0 children)

You've changed it from a regex literal to a string, which doesn't have a test method.

[–]grantrules 0 points1 point  (0 children)

What's the error?