IP Adresses 2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

IP Adresses 2

Okay so for this one im trying to actually show the user their IP. Heres the url to the website as a reference https://www.ipify.org/ its not giving me any kind of error i see so what is the problem here? https://code.sololearn.com/WSAhNMGKsXOK

22nd Jun 2022, 8:49 PM
Junior
Junior - avatar
15 Answers
+ 1
Your code does return an error. Get IP not defined.
22nd Jun 2022, 9:37 PM
Chris Coder
Chris Coder - avatar
0
so how do i exactly make it defined? also r yall doing ctrl + shift + i? or r u using sololearn console?
22nd Jun 2022, 9:39 PM
Junior
Junior - avatar
22nd Jun 2022, 9:41 PM
Chris Coder
Chris Coder - avatar
0
first i had to make my console.log to document.write()
22nd Jun 2022, 9:49 PM
Junior
Junior - avatar
0
secondly i had to put my first script src
22nd Jun 2022, 9:51 PM
Junior
Junior - avatar
0
below my script containg my function and console
22nd Jun 2022, 9:51 PM
Junior
Junior - avatar
0
So 2 questions. why and why?? why do i have to do that and doesnt work how it was before
22nd Jun 2022, 9:52 PM
Junior
Junior - avatar
0
Maybe this can help about why the script belongs at the bottom. https://levelup.gitconnected.com/all-about-script-87fea475b976
23rd Jun 2022, 2:54 AM
Chris Coder
Chris Coder - avatar
0
I didnt see anything about putting a script at the bottom of the page. did u? Also why did i have to change the console.log to document.write?
23rd Jun 2022, 3:26 AM
Junior
Junior - avatar
0
Yes i did see something about placements. "When you place your JavaScript at the bottom of your HTML body, it gives the HTML time to load before any of the JavaScript loads, which can prevent errors, and speed up website response time." It is not clear but I suppose that means your api loaded before your script. So it was out of scope. Also now that you have your tags in the correct order, you can use console.log
23rd Jun 2022, 1:51 PM
Chris Coder
Chris Coder - avatar
0
Hmm..ok. But my console.log does not work unless it only works on computer or smth .
23rd Jun 2022, 2:30 PM
Junior
Junior - avatar
0
Chris Coder Is the console.log working for u?
24th Jun 2022, 3:28 PM
Junior
Junior - avatar
0
Yes console shows up right after I run the code. But if I swipe down to hide it I can not make it come back up.
24th Jun 2022, 3:39 PM
Chris Coder
Chris Coder - avatar
0
Keep trying to swipe up from the bottom it finally worked for me
24th Jun 2022, 3:40 PM
Chris Coder
Chris Coder - avatar
0
okay
24th Jun 2022, 4:05 PM
Junior
Junior - avatar