DEV Community

Cover image for My Naruto Website
Usman
Usman

Posted on

My Naruto Website

This blog is about my passion which is about Naruto, So What I did was that I got the information of the Naruto characters. I got the information of the characters from an API. I fetched the api and got all of the characters and their informations. I then declared a variable called and got the query selector form the html the id that was mySearch. I then made an addEventListener, in which I put a submit button I had an event as a parameter, I wrote a preventDefault that will invoke the cancel attribute if true. I then logged out the characters that I declared in the global scope. That's how how I got all of the characters and their informations, when you hit the search button. I then declared a userInput in which I made a query selector in which I got the id #mySearch from input element and I then logged out the userInput then I get information I typed in the search bar, after that I made another variable called narutoCharacters in which I used the find method and I used the the global scope of the characters, inside the find method I declared a parameter called character, I then basically use the arrow function and I typed character with the dote name and equal to the userInput, what this would basically do is in order to get a specific information about a character I would type it in the search button to get that information. I then logged out the narutoCharacters and in my search bar when I typed in the name of a specific character I would get that information.

Top comments (0)