// fetch = Function used for making HTTP requests to fetch resources. // (JSON style data, images, files) // Simplifies asynchronous data fetching in JavaScript and // used for interacting with APIs to retrieve and send // data asynchronously over the web. // fetch(url, {options}) async function fetchData(){ try{ const pokemonName = document.getElementById("pokemonName").value.toLowerCase(); const response = await fetch(`pokeapi.co/api/v2/pokemon/${pokemonName}`); if(!response.ok){ throw new Error("Could not fetch resource"); } const data = await response.json(); const pokemonSprite = data.sprites.front_default; const imgElement = document.getElementById("pokemonSprite"); imgElement.src = pokemonSprite; imgElement.style.display = "block"; } catch(error){ console.error(error); } }
Have always loved your videos thanks for this one particularly cos it’s exactly how I learn constants down, if not statement down variables being called down it’s sick thank you
From the buttom of my heart, and on behalf of everyone. i would like to thank you so much bro….. been struggling for months with this!!!😭❤️🙏🏾. Hoping to receive a reactJS one. Once again, thank you.
in my bottom of the heart i really appreciate you. here lot of middle class student like me. your tutorial helped me alot without any fee. thanks keep going. i expected more tutorial from you😇😇😇😇
THIS IS THE BEST TUTORIAL IN TH-cam ABOUT THIS. And my favorite pokemon is cyndaquil so when you said Typhlosion I was like whaaaaaaaaaaaaat! What are the odds? hahaha
Bro I made it 🤩🤩🤸♀🤸♀, the think is I just want to keep watching your videos. I thought I would never understand Java script.Hopefully this year I'm going to be able to make it! Send you a hug!
Great stuff. 2questions - is using the straight form data a security risk from injection attacks? How would you stop and abort or prevent too many requests at once?
For XSS make sure that you don't use innerHTML for inserting data in the DOM. You can use innerText or setHTML if you need to insert html as setHTML sanitize the input
Hey Bro, this question has actually nothing to do with this video but I’ve got a project where I have to implement the best move of the computer in the game TicTacToe. I just started to learn java but that’s quite hard. Do you have some tips for me? The computer has to try to defeat me and block me by placing the symbol to places wherever I could win. I hope that you will answer. Hava a nice day.
// fetch = Function used for making HTTP requests to fetch resources.
// (JSON style data, images, files)
// Simplifies asynchronous data fetching in JavaScript and
// used for interacting with APIs to retrieve and send
// data asynchronously over the web.
// fetch(url, {options})
async function fetchData(){
try{
const pokemonName = document.getElementById("pokemonName").value.toLowerCase();
const response = await fetch(`pokeapi.co/api/v2/pokemon/${pokemonName}`);
if(!response.ok){
throw new Error("Could not fetch resource");
}
const data = await response.json();
const pokemonSprite = data.sprites.front_default;
const imgElement = document.getElementById("pokemonSprite");
imgElement.src = pokemonSprite;
imgElement.style.display = "block";
}
catch(error){
console.error(error);
}
}
Document
Fetch Pokemon
Thanks, can you help me? I want the code to give me the logo
I learn by using fun projects perhaps you could teach us how to make a little button based two player react game with this or something bro?
Have always loved your videos thanks for this one particularly cos it’s exactly how I learn constants down, if not statement down variables being called down it’s sick thank you
thank you for your video
well said , i feel the same .
Fun Tutorial, really enjoyed it! Using Pokemon made it so much better than some other boring data.
From the buttom of my heart, and on behalf of everyone. i would like to thank you so much bro….. been struggling for months with this!!!😭❤️🙏🏾. Hoping to receive a reactJS one. Once again, thank you.
Not only a progammer but also a pokemon fan.
Same 🙂
So what ?
@@alternate_fantasy ur mom
@@diegocamacho6060 dont be sad kid :( im sorry for your life
@@alternate_fantasy ur mom
I really enjoy the way you explain how you are writing the code and why. Very informative and you make it intuitive. Great work!
Perfect tutorial, perfect teaching, perfect free api
in my bottom of the heart i really appreciate you. here lot of middle class student like me. your tutorial helped me alot without any fee. thanks keep going. i expected more tutorial from you😇😇😇😇
THIS IS THE BEST TUTORIAL IN TH-cam ABOUT THIS. And my favorite pokemon is cyndaquil so when you said Typhlosion I was like whaaaaaaaaaaaaat! What are the odds? hahaha
using the pokemon api was a good choice for a introduction to fetch
bro you're a legend. thank you for making code easier to learn.
Thank you BroCodez! You are an angel to us new programmers 😊. I am sure all the newcomers will find this video extremely helpful 👍🏼
Unreal! So well explained, simple and FUN! +1 subscriber ♥
i really enjoy all of your videos bro, you helped me a lot with this course, thank you!
Psd: lucario is my fav pokemon
Enjoyed working along with this tutorial. All I can say is 👍
this isn't included in your full Javascript course but i appreciate your efforts for doing it seperate
His full Javascript course was made awhile ago, this is a new updated version of that course.
Amazing tutorial I’m gonna try this, style it nicely and flex on my class lmaooo
This bro is a HERO!!! 🔥🙏🙏👏👏👏👏
definitely the best explanation I've ever watch
Bro I made it 🤩🤩🤸♀🤸♀, the think is I just want to keep watching your videos. I thought I would never understand Java script.Hopefully this year I'm going to be able to make it! Send you a hug!
i watch many tutorials on this topic but didn't understand it thanks for your video now i am finally understand it
PERFECT TIMINGGGG THANK YOUUUUUU
You have made my day. Thanks a lot
I really thank you for your on-point tutorial really helping me advance my lil skills
awesome explanation
Thanks for the help! Got everything working on my weather project now I just need to finish the CSS
Thank you for the video
Very good explained! thanks!
To be honest I was about to look for JavaScript form, about fetching and yes good counter I found this video xD
just finished every tutotial in this playlist
So great
very good, liked!
loved the content man.
good tutorial 👍
Alternative Title :- Bro Code flexing his knowledge about pokemon's.
@BroCodez super project do more 5 more projects basic to depth
❤❤❤❤❤❤❤❤❤❤
This guy is a legend
Thanks bro.nice 😊😊😊😊😊 tutorial
thanks, this video was super useful 😀
the things i need right on time 😊😊
This was a better explanation of fetch then the shit they have on codecademy
The broest Bro I've ever had
Keep the good work up!
It would be so appreciated if you did a beginner course on Rust
all love
amazing tutorial man thanks
So nice
THANKS BRO!!!🙌🙏🙏
super explanations bro
awesome, thanks bro 💕
I LOVE YOU BRO CODE 🤩🤩🤩
thank U to much Mr.Pokemon🔥❤🔥
thank you man
とても分かりやすい投稿ですね!JavaScriptを使ってAPIからデータをフェッチする方法について、具体的なコード例が参考になりました。実践に役立ちそうです。ありがとうございます!
俺にもよく役立つくらいになりますね
プログラミングの道はかなり難しくてけれどモチベーションがあれば人間として俺たちが何でも出来るとおもいますよ
That typhlosion endpoint did not age well. If you know you know
waiting for this lol
Super helpful
Ty trainer 😊
if you can please do axios video also and how to handle express error objects meaningful status code error massages in real world app
definitely geodude. Thanks for making this fun.
cool thanks you make it so easy
👍thanks man
Thank you very helpful.
Please teach us lua in 2024!!! thanks for your content
👍👍👍👍
If she aint into me like he is into Typhlosion, I don’t want it!
it was amazing
Thanks Bro
Thank you!
Thank you
You will make node is course?
I wish I found Bro Code earlier in my ‘teaching myself to code’ journey
groudon the goat honorable mention rayquaza
Great stuff.
2questions - is using the straight form data a security risk from injection attacks?
How would you stop and abort or prevent too many requests at once?
For XSS make sure that you don't use innerHTML for inserting data in the DOM. You can use innerText or setHTML if you need to insert html as setHTML sanitize the input
THANKS
perfect! Bro Code
Cool
Question: what if we would not prefer to use async and await? how do we display the image with the fetch?
thank you alot
should we not add an else block after checking response.ok property?
I always get so caught up use the data to display an image or whatnot and then miss the lesson....
can you do a vue or react tutorial ?
Hi bro, are you going to do a go course in the future?
hey, can u do a ruby course ? pls
are you able to teach php and sql
How can i access object in an api and display on html I'm getting type error 😢
Hey Bro, this question has actually nothing to do with this video but I’ve got a project where I have to implement the best move of the computer in the game TicTacToe. I just started to learn java but that’s quite hard. Do you have some tips for me?
The computer has to try to defeat me and block me by placing the symbol to places wherever I could win.
I hope that you will answer.
Hava a nice day.
cool
Can you please make a video like this in c++
hello bro will their be any more videos on React JS?
Oh my god....what were the chances....even typhlosion is my favourite pokemon...
minun!
For the first part, are the html and css files empty? I would assume so, but then how do you run JS in the console
By running the code and looking at the responses the console gives in your browser or vscode
NodeJS course pls
Code bro react bro.... My life bro.... My heart bro.... Plz bro do bro......
is it possible to do sorting
THe Api's were fetching too slow on safari I thought I have error in my code but then switched to chrome then it worked smooth
my favorite pokemon is breloom I like using him to kidnap other pokemon
bro please do php crud operation video please make as soon as possible
Do python next😢
Make on lua pls
I wont text generating logo with AI
Dragonite :D