DEV Community

loading...

Discussion on: Pokemon API and React

Collapse
omkar76 profile image
Omkar76

Before I try to answer let me introduce myself.

I'm not a JS expert.
I haven't touched react 😬.
I still love JS.
This is my first comment.

well, let me try.

  1. So you want case insensitive comparison of strings.
let pokemon = "pikachu";
let guess = prompt("What do you think it's? ");

if(guess.trim().toLowerCase() ===pokemon) {
  alert("That was correct!");
}else{
  alert("You need to do more  research");
}

first trim the string. Trim method removes leading and trailing white spaces from string.

convert user input to lowercase and then do comparison.

This is what I did in my code coach project on sololearn

Collapse
omkar76 profile image
Omkar76
  1. Hard to say anything without reading you code ☺
Collapse
ivanradunkovic profile image
Ivan Radunković Author

Hi Omakar76, many thanks for your help.

This is my git repo with this issues

github.com/ivanradunkovic/Pokemon