I am completely stuck

@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

This docs explain properly how to add an image from a device/computer file or from a website, the method is same, what change is the source of the image(src).
https://www.w3schools.com/html/html_images.asp

As long as the image have a proper image file format, you can use it (png, gif, jpg, etc…).

I also advice to save the w3school website which you can use to understand further any syntaxes. :nerd_face:

Carlos Z

Thanks, I will try both of these and reply :pray:

1 Like

is there not a “help” function in javascript??
in matlab you can, iirc, type
"
help(function_name)
"
(without semicolon in order not to suppress output)
and get a brief paragraph or two explanation of the function, it’s inputs/outputs, and how to use / what behavior to expect from it; is there not something similar in javascript? i’ve tried various syntax variants of that above, i’ve DDG’ed, looked into tutorials (searching “help function”, and searched here for the same (say someone mention jquery in an unconvincing way), but no-go so far…

Hey @B_S, hope you are well.

I think there is none, this is a programming language, so it does not have any software to ask help about it. You coulde use websites like https://www.w3schools.com/js/default.asp to get any information about the methods allowed on javascript.

Carlos Z

1 Like

Hey @Moonboy007, hope you are well.

Please share your code in the following way so we can help you review it :face_with_monocle:

Carlos Z

thanks, that looks much better yes!

Need help with the exercises in Chapter 2 of the Eloquant Javascript pdf. Been at it for 2 days. keep going in circles.
I am completely stuck in chapter 2 with the fizz buzz and chess board exercise. I understand I need to do a loop and a if else function, but I just don’t know what I am doing wrong.
The console says I have an uncaught syntax error: unexpected end of input. Whatever that means.
My code is:

<html>
<head>

<title>This is a great project</title>

</head>

<body>
<script>
 var num_rows = 100;
 for(var row = 1; row < num_rows; row++){
    if (row / 15 == 0){
      console.log("fizz buzz ");
    } else if (row / 3 == 0) {
      console.log("fizz ");
    } else if (row / 5 == 0) {
      console.log("buzz ");
    } else{console.log(row)};




</script>

</body>



</html>

You are just missing the close tag for the for loop } at the end of it.

 var num_rows = 100;
 for(var row = 1; row < num_rows; row++){
   if (row / 15 == 0){
      console.log("fizz buzz ");
    } 
   else if (row / 3 == 0) {
      console.log("fizz ");
    } 
   else if (row / 5 == 0) {
      console.log("buzz ");
    } 
   else{
     console.log(row);
   }
 }

Carlos Z

nice, thanks for your input, thecil
my experience in matlab was that you could just pull the function code itself, and comments were written in the few lines after the form definition… if that’s not already a function in javascript, maybe i’ll try writing a preliminary one…

Hello, I have some difficulty with the final step of Terminal-Nodes. It seems that I have it successfully installed.
So far so good, but when I go further and try to test nodes demo test.js (by following Ivan’s instruction) the terminal shows me two message;
Module_NOT_FOUND / No such file or directory!
Where is the problem?

Thank you for your help!

Some screen shots

Capture d’écran 2021-09-22 à 16.48.42

Capture d’écran 2021-09-22 à 19.10.11

Capture d’écran 2021-09-22 à 19.42.57

If you have an error about MODULE missing, its probably that you have not installed all the modules properly, for that you need to run npm install which will download and install all the dependecies from the package.json file of your project.

Carlos Z

Hello, I’m stuck somewhere in the for loops. I hope someone could help me. I came across this problem when I did the looping triangle exercise.I thought I got it correctly, but it was executed differently on the lecture. So I got curious as to how the code blocks are executed and I got stuck here.

I wanted to understand how does the updating of my toPrint variable works here. I have 2 scenarios, one is I’ve declared the var toPrint before the loop call, and the other one is inside the code block of the first loop.

They both return different set of values so I’m trying to understand how the first example works.

First example returns;
image

var toPrint = “#”;
var num_rows = 7;
for(var row = 0;row<num_rows; row++){

for(var column = 0;column<row; column++){toPrint = toPrint + "#"};

console.log(toPrint)
}

Second example returns;
image

var num_rows = 7;
for(var row = 0;row<num_rows; row++){var toPrint = “#”;

for(var column = 0;column<row; column++){toPrint = toPrint + "#"};

console.log(toPrint)
}

What only make sense to me is the second example. I’ve been playing around and searching thru the net to understand why they return different values and got nothing. Where does the increments of +1,+2,+3,+4,+5,+6 of "#"s from the first example pulls? Please help me understand.

Thank you!

1 Like

Hi Carlos,

Is npm install a program which I have first to download?

Could it be that apple shell is outdated?
Because in the shell window is written that the default interactive shell is now zsh.

Thanks in advance

1 Like

anyone can help?
this is not working.

<body>

    <h1>My fruits</h1>

    <ol id="myfruits">
    </ol>
    <input type="text" id="myinput">
    <input type="submit" id="btnSubmit">
    <script>

      var fruitlist = ["peach"];
      var list = $("#myfruits");
      console.log(list);

      $.each(fruitlist,function(index,value){
          $("<li/>").text(value).appendTo(list);
      })

      $("#btnSubmit").click(function(){
        var fruitVal = $("#myinput").val();
        fruitlist.push(fruitVal);
      });





    </script>
  </body>
1 Like

When I load my website it comes out as a blank page with nothing on it and the console is blank as well?
var = num_rows = 7;
for(var row = 0; row < num_rows; rows++){
var toPrint = “#”;

    for(var column = 0; column<row; column++){
      toPrint += "#";

    }
    console.log(toPrint);
  }
1 Like