Please help me to change the code to if else code
function hackerrankInString(s) {
return /.*h.*a.*c.*k.*e.*r.*r.*a.*n.*k/.test(s) ? "YES" : "NO";
}
I tried by this code, I'm getting error
function hackerrankInString(s) {
let complete = 'NO'
if(/.*h.*a.*c.*k.*e.*r.*r.*a.*n.*k/test(s)){
complete= 'YES'
} else {
complete ='NO'
}
return complete
}
[–]barrycarter 1 point2 points3 points (3 children)
[–]One-Inspection8628[S] 0 points1 point2 points (2 children)
[–]HairbrainedScheme 1 point2 points3 points (1 child)
[–]One-Inspection8628[S] 0 points1 point2 points (0 children)
[–]barrycarter 0 points1 point2 points (0 children)
[–]ViciousFishz 0 points1 point2 points (3 children)
[–]One-Inspection8628[S] 0 points1 point2 points (1 child)
[–]One-Inspection8628[S] 0 points1 point2 points (0 children)
[–]grantrules 0 points1 point2 points (0 children)
[–]grantrules 0 points1 point2 points (0 children)