How to FETCH data from an API using JavaScript ↩️

  Рет қаралды 156,809

Bro Code

Bro Code

Күн бұрын

Пікірлер: 128
@BroCodez
@BroCodez 11 ай бұрын
// 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
@talebmine6562
@talebmine6562 7 ай бұрын
Thanks, can you help me? I want the code to give me the logo
@Smurfis
@Smurfis 5 ай бұрын
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?
@Smurfis
@Smurfis 5 ай бұрын
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
@coding6291
@coding6291 6 күн бұрын
Fun Tutorial, really enjoyed it! Using Pokemon made it so much better than some other boring data.
@alextruong1826
@alextruong1826 7 ай бұрын
thank you for your video
@ay111nbg6
@ay111nbg6 6 ай бұрын
well said , i feel the same .
@AyandaGumede-q5t
@AyandaGumede-q5t 10 ай бұрын
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.
@ShortSnickers101
@ShortSnickers101 11 ай бұрын
Not only a progammer but also a pokemon fan.
@Th3Coder
@Th3Coder 10 ай бұрын
Same 🙂
@alternate_fantasy
@alternate_fantasy 7 ай бұрын
So what ?
@diegocamacho6060
@diegocamacho6060 7 ай бұрын
@@alternate_fantasy ur mom
@alternate_fantasy
@alternate_fantasy 7 ай бұрын
@@diegocamacho6060 dont be sad kid :( im sorry for your life
@diegocamacho6060
@diegocamacho6060 7 ай бұрын
@@alternate_fantasy ur mom
@NiceChange
@NiceChange 4 ай бұрын
I really enjoy the way you explain how you are writing the code and why. Very informative and you make it intuitive. Great work!
@bekay7663
@bekay7663 5 ай бұрын
using the pokemon api was a good choice for a introduction to fetch
@abinayag4050
@abinayag4050 9 ай бұрын
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😇😇😇😇
@falakchudasama9746
@falakchudasama9746 Ай бұрын
Perfect tutorial, perfect teaching, perfect free api
@kopilkaiser8991
@kopilkaiser8991 Ай бұрын
Thank you BroCodez! You are an angel to us new programmers 😊. I am sure all the newcomers will find this video extremely helpful 👍🏼
@Vincent_12770
@Vincent_12770 11 ай бұрын
this isn't included in your full Javascript course but i appreciate your efforts for doing it seperate
@TheBlueDude71
@TheBlueDude71 11 ай бұрын
His full Javascript course was made awhile ago, this is a new updated version of that course.
@RJ100
@RJ100 7 ай бұрын
bro you're a legend. thank you for making code easier to learn.
@eusoumateusrocha
@eusoumateusrocha 8 ай бұрын
THIS IS THE BEST TUTORIAL IN KZbin ABOUT THIS. And my favorite pokemon is cyndaquil so when you said Typhlosion I was like whaaaaaaaaaaaaat! What are the odds? hahaha
@underwhip5
@underwhip5 Ай бұрын
That typhlosion endpoint did not age well. If you know you know
@numberonemathlete3038
@numberonemathlete3038 29 күн бұрын
waiting for this lol
@emir-mu1bs
@emir-mu1bs 5 ай бұрын
definitely the best explanation I've ever watch
@muhammadshazeel567
@muhammadshazeel567 8 ай бұрын
i watch many tutorials on this topic but didn't understand it thanks for your video now i am finally understand it
@user-lx8mh
@user-lx8mh 3 ай бұрын
Thanks for the help! Got everything working on my weather project now I just need to finish the CSS
@larvey_
@larvey_ 5 ай бұрын
I really thank you for your on-point tutorial really helping me advance my lil skills
@uwayss_11
@uwayss_11 3 ай бұрын
This bro is a HERO!!! 🔥🙏🙏👏👏👏👏
@JorgeHernandez-fo5kl
@JorgeHernandez-fo5kl 11 ай бұрын
i really enjoy all of your videos bro, you helped me a lot with this course, thank you! Psd: lucario is my fav pokemon
@moeyk97
@moeyk97 9 ай бұрын
Amazing tutorial I’m gonna try this, style it nicely and flex on my class lmaooo
@nicktorius8910
@nicktorius8910 3 ай бұрын
just finished every tutotial in this playlist
@andrisalazar7565
@andrisalazar7565 2 ай бұрын
Very good explained! thanks!
@danielwolks8494
@danielwolks8494 5 ай бұрын
This was a better explanation of fetch then the shit they have on codecademy
@drewxx8527
@drewxx8527 11 ай бұрын
To be honest I was about to look for JavaScript form, about fetching and yes good counter I found this video xD
@vaibhavagarwal1479
@vaibhavagarwal1479 5 ай бұрын
Alternative Title :- Bro Code flexing his knowledge about pokemon's.
@HuracanSeneca
@HuracanSeneca 11 ай бұрын
If she aint into me like he is into Typhlosion, I don’t want it!
@CôngVinhPhạm-e6o
@CôngVinhPhạm-e6o 17 күн бұрын
So great
@SafiAbdulWajid
@SafiAbdulWajid Ай бұрын
awesome explanation
@vallunacoder.wecodetogether
@vallunacoder.wecodetogether 9 ай бұрын
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!
@4soulsz
@4soulsz 11 ай бұрын
PERFECT TIMINGGGG THANK YOUUUUUU
@memeingthroughenglish7221
@memeingthroughenglish7221 5 ай бұрын
definitely geodude. Thanks for making this fun.
@regilearn2138
@regilearn2138 5 ай бұрын
if you can please do axios video also and how to handle express error objects meaningful status code error massages in real world app
@addyjaime465
@addyjaime465 6 ай бұрын
This guy is a legend
@2faststudios571
@2faststudios571 4 ай бұрын
thanks, this video was super useful 😀
@kyleshivers
@kyleshivers 11 ай бұрын
I wish I found Bro Code earlier in my ‘teaching myself to code’ journey
@gibbaren2552
@gibbaren2552 11 ай бұрын
Keep the good work up! It would be so appreciated if you did a beginner course on Rust all love
@fume6970
@fume6970 9 ай бұрын
The broest Bro I've ever had
@nicktorius8910
@nicktorius8910 3 ай бұрын
groudon the goat honorable mention rayquaza
@tthamil
@tthamil 4 ай бұрын
super explanations bro
@ofekcohen6559
@ofekcohen6559 11 ай бұрын
You will make node is course?
@MatheusFix
@MatheusFix 11 ай бұрын
Please teach us lua in 2024!!! thanks for your content
@shaw848
@shaw848 4 ай бұрын
good tutorial 👍
@ajayxoxo
@ajayxoxo 11 ай бұрын
the things i need right on time 😊😊
@r-i-ch
@r-i-ch 4 ай бұрын
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?
@lolxnn
@lolxnn 3 ай бұрын
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
@lounes03b99
@lounes03b99 7 ай бұрын
thank U to much Mr.Pokemon🔥❤‍🔥
@MiriamGordilloChavez
@MiriamGordilloChavez 7 ай бұрын
Question: what if we would not prefer to use async and await? how do we display the image with the fetch?
@princesstechideas
@princesstechideas 5 ай бұрын
Thanks bro.nice 😊😊😊😊😊 tutorial
@rahimrahim2720
@rahimrahim2720 4 ай бұрын
cool thanks you make it so easy
@luizhqdo
@luizhqdo 2 ай бұрын
very good, liked!
@raghabpandit2610
@raghabpandit2610 6 күн бұрын
TypeError: Cannot read properties of undefined (reading 'front_default')
@Elexir.189
@Elexir.189 11 ай бұрын
I LOVE YOU BRO CODE 🤩🤩🤩
@haniehsolatpour8945
@haniehsolatpour8945 6 ай бұрын
So nice
@SushiK994
@SushiK994 Ай бұрын
thank you man
@Mr_hinch
@Mr_hinch 3 ай бұрын
THANKS BRO!!!🙌🙏🙏
@valenciawalker6498
@valenciawalker6498 8 ай бұрын
Thank you very helpful.
@l213dhanesh3
@l213dhanesh3 11 ай бұрын
Code bro react bro.... My life bro.... My heart bro.... Plz bro do bro......
@watashiaashishgurung
@watashiaashishgurung 2 ай бұрын
Ty trainer 😊
@2ameridiem
@2ameridiem 8 ай бұрын
should we not add an else block after checking response.ok property?
@QuadriCSGO
@QuadriCSGO 9 ай бұрын
amazing tutorial man thanks
@zyntaXmods
@zyntaXmods 10 ай бұрын
How can i access object in an api and display on html I'm getting type error 😢
@Blitz61wasd
@Blitz61wasd 11 ай бұрын
Cool
@nopass6247
@nopass6247 11 ай бұрын
awesome, thanks bro 💕
@پارساچاوشی-ب8خ
@پارساچاوشی-ب8خ 11 ай бұрын
it was amazing
@BijouBakson
@BijouBakson Ай бұрын
Thank you
@aley681
@aley681 11 ай бұрын
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.
@shafiulAlamShafi
@shafiulAlamShafi 10 ай бұрын
Super helpful
@_4p_
@_4p_ Ай бұрын
👍thanks man
@marouanebr409
@marouanebr409 7 ай бұрын
👍👍👍👍
@HammerBummer-ro9ik
@HammerBummer-ro9ik 3 ай бұрын
perfect! Bro Code
@erialgumacoisa
@erialgumacoisa 10 ай бұрын
Thanks Bro
@_____vieve
@_____vieve 2 ай бұрын
THANKS
@lakivicsa
@lakivicsa 9 ай бұрын
Thank you!
@doronfeldman5152
@doronfeldman5152 10 ай бұрын
Hi bro, are you going to do a go course in the future?
@parikshitkolhe3295
@parikshitkolhe3295 8 ай бұрын
Oh my god....what were the chances....even typhlosion is my favourite pokemon...
@programmated_brian
@programmated_brian 11 ай бұрын
loved the content man.
@ghost.-.1290
@ghost.-.1290 11 ай бұрын
cool
@sr.pinheiro6386
@sr.pinheiro6386 11 ай бұрын
hey, can u do a ruby course ? pls
@weemarb
@weemarb 10 ай бұрын
my favorite pokemon is breloom I like using him to kidnap other pokemon
@maxknight8542
@maxknight8542 11 ай бұрын
are you able to teach php and sql
@muhammadyousaf2876
@muhammadyousaf2876 9 ай бұрын
thank you alot
@minh355
@minh355 6 ай бұрын
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
@IAmNOTTHEBODY
@IAmNOTTHEBODY Ай бұрын
By running the code and looking at the responses the console gives in your browser or vscode
@feelthesurge1003
@feelthesurge1003 11 ай бұрын
hello bro will their be any more videos on React JS?
@erialgumacoisa
@erialgumacoisa 10 ай бұрын
NodeJS course pls
@belgian_wolvie8875
@belgian_wolvie8875 2 ай бұрын
My favorite pokemon is jequavius
@sebs178
@sebs178 2 ай бұрын
minun!
@harbirdhillon8195
@harbirdhillon8195 6 ай бұрын
Favorite Pokemon: Lugia
@youngtrouble00
@youngtrouble00 11 ай бұрын
Do python next😢
@eagledeluxe826
@eagledeluxe826 11 ай бұрын
Make on lua pls
@alternate_fantasy
@alternate_fantasy 7 ай бұрын
Quite not fair for a very basic and general video got such views.
@talebmine6562
@talebmine6562 7 ай бұрын
I wont text generating logo with AI
@JuanRobertoDejon-t6d
@JuanRobertoDejon-t6d 11 ай бұрын
Dragonite :D
@manueljoseph3528
@manueljoseph3528 7 ай бұрын
is it possible to do sorting
@Dhanasekar-l4t
@Dhanasekar-l4t 11 ай бұрын
bro please do php crud operation video please make as soon as possible
@KiNGgamer-km4zi
@KiNGgamer-km4zi 11 ай бұрын
Sir bro node js please
@Mr-MITRA
@Mr-MITRA 8 ай бұрын
from today pikachu
@capslock3250
@capslock3250 11 ай бұрын
Kotlin or Golang course please.
@codeJourneyGuides
@codeJourneyGuides 8 ай бұрын
SpongeBob is still not a Pokemon lol 😂
@notacupofmilk2021
@notacupofmilk2021 4 ай бұрын
2:15
@hamzagohar2048
@hamzagohar2048 4 ай бұрын
#utorial XD
Build a JavaScript WEATHER APP in 30+ minutes! ☀️
38:40
Bro Code
Рет қаралды 54 М.
What are JavaScript PROMISES? 🤞
12:37
Bro Code
Рет қаралды 77 М.
This Game Is Wild...
00:19
MrBeast
Рет қаралды 160 МЛН
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 6 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 101 МЛН
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
Fetching Data in React - Complete Tutorial
29:10
Cosden Solutions
Рет қаралды 142 М.
JS Promises in 4 Minutes
3:51
CodeNexus
Рет қаралды 1,1 М.
Learn Fetch API In 6 Minutes
6:35
Web Dev Simplified
Рет қаралды 1,3 МЛН
APIs Explained (in 4 Minutes)
3:57
Exponent
Рет қаралды 1 МЛН
Learn JSON files in 10 minutes! 📄
10:09
Bro Code
Рет қаралды 61 М.
Ten Steps to Mastering the Fetch API
2:19:52
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 48 М.
JavaScript Visualized - Event Loop, Web APIs, (Micro)task Queue
12:35
Modern Data Fetching in React (Complete Guide)
16:41
Cosden Solutions
Рет қаралды 67 М.
This Game Is Wild...
00:19
MrBeast
Рет қаралды 160 МЛН