I am completely stuck

Thank you very much:).

After writing several exercises in Google Script for both the looping problem and FizzBuzz, I always come up with an error and corrections that are suggested by Google. I apply the corrections and there is something else that prevents the triangle from presenting. Or writing FizzBizz. I would like to continue on with the program and come back to Lesson 2 exercises when I know more about the JavaScript rules.

Hey guys,
How do you resize the image?
image

Hey @tuenkhbold, hope you are ok.

You might need to add the style for width and heigth, which are the dimensions for the img.
Example: <img src="img_girl.jpg" alt="Girl in a jacket" style="width:500px;height:600px;">

https://www.w3schools.com/html/html_images.asp

Carlos Z

Hey @Lorraine, hope you are ok.

I think you should not use Google Script for the exercises since it have another rules and might be why is not showing you properly the result. Easiest way is just to do a JS file and run it on a browser or console.

Carlos Z

Hello, hope youre doing awesome.

Question related to the first exercise “Triangle Loop” in Chapter 2 of Eloquent Javascript. @thecil

Write a loop that makes seven calls to console.log to output the following
triangle:

#######

Ive noticed theres some ways of doing these, Ivan did it one way, The author other way, and i did it like this:

    let ast = "#";
    let counter = 0;
    while (counter<7){
        console.log(ast);
        counter = counter+1;
        ast = ast+"#";
      } 

All 3 solved the problem, its my answer bad because it was the longest? Or is it it’s fine as long as you solve it. Thanks!

1 Like

hey @salvatorev, hope you are ok.

In programming, there are multiple ways to solve a problem, and all of them are completely valid, the difference is on code efficiency.

Consider this: There is a function which have 100 code lines, I could achieve the same result but with a function that only have 20 code lines, both approach are completely valid (cuz both will return you the same result), the difference will be in terms of code efficience, maintenance and improvements. (its easier to improve a 20 code line function than 100 code lines)

Carlos Z

1 Like

hey guys. I’m not sure if my code is right/another way of doing the exercise shorter than what ivan showed us but i got this…

for (let number = "#"; number <= "#######"; number += "#") {console.log(number);}
1 Like

it still gives you the same result

All good you still getting the same result in terms of iterating the variable and building the piramid :nerd_face:

Carlos Z

Hi,

OK so I am stuck in that I cannot get an image to display in HTML. I have tried looking at various articles on Google, tried a local image as well as one online and cannot get any of them to work. Below is the code using a link to an image on my google drive.

Thanks in advance for any assistance ?

Hey @Allistair_Trent, hope you are ok.

Please provide the code so we can help you review it, you can follow this guide to post properly your code in the forum:

https://forum.ivanontech.com/t/faq-how-to-post-code-in-the-forum/35357/2

Carlos Z

Hi, Thanks
The code is below
<img scr="https://drive.google.com/file/d/1cI3jTQdxDeFtDN4zA6bcsywpcC_peavh/view?usp=sharing">

1 Like

<img src+“img/skycat.jpg” alt=“Cat peering though hole in the sky”>

HI, I’m going insane. Not only was Ivan’s video clear as mud, I have now watched countless
“How To img Javascript” videos and am on to reading the book! All just to try to understand how to use img !! Unbelievable frustration so early into this one course.

Yes, I’m now reading “Eloquent Javascript” book just to learn how to use img.
Ivan does not make it clear at all. How do you literally, step by step, use an image from Both an online source AND from your computer? This is a Beginner course. May I have some help to move through this so I can actually continue studying?

2 Likes

Hi friends,
I am facing a strange problem. And I am not able to find a solution to it anywhere. I installed VS Code on my macbook. but I am not able to take the output on webpage as there is no option of ‘open on live server’. I have reinstalled VScode twice. While on my desktop, I am able to open on web page. is there any problem with mac version? Pls help.Screen Shot 2021-07-11 at 9.00.39 AM

1 Like

@Melanie, check this one also :nerd_face:

The problem is on the url of your image, the source (src) must be exactly the file.
For example:
<img src="https://s3-eu-west-1.amazonaws.com/tpd/logos/5e8725fdf30887000135083d/0x0.png">

Notice that my url ends with a PNG file, the same must apply to yours (google does not provide the direct url of the file, thats why your is not being recognized has one).

Carlos Z

Hey @Gaurav, hope you are ok.

You could install the “Live Server” extension for VS or use the python server that we explain further in the course.

Carlos Z

@ivan, I’m about to start the Javascript Programming course. I would like to know if I should purchase the 2nd edition of the Eloquent Javascript which the link on the course points to, or if I should go ahead and purchase the latest edition of the book (3rd Edition)?

Hey @Raneil, hope you are well.

You could download the 3rd version for free in their website: https://eloquentjavascript.net/

This is a link to download directly the book as PDF: https://eloquentjavascript.net/Eloquent_JavaScript.pdf

If you want the book physically, then you will have to buy it, but for the course, the digital version (PDF) is more than enough :nerd_face:

Carlos Z

Hi Carlos, thanks so much for replying I was feeling abandoned!

I have a few questions about the answer that you’ve given me…

Firstly, my image was not from a website. It was from my computer. I really think the course should clearly show students how to add an image from a website AND an image from their device/computer.

How do I do this? please help. Because I have now watched extra online videos and am reading Eloquent Javascript book, for goodness sake.

You’ve mentioned PNG. Does every image used in JS need to be PNG? I was attempting to use JPEG as said in the course video.

Thanks Carlos