I am completely stuck

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

Guys, I am stuck on the first step, and that’s I cannot even get ATOM to work on my MAC laptop. I am running the latest OS. It’s saying " You can’t open the application “Atom” because the Classic environment is no longer supported.

And safari then proceeds to tell me no application can open it?

EDIT: Resolved. So if this was my first test into the programming life for trouble shootings, good job guys haha.

1 Like

this declaration is incorrect, it should be var num_rows = 7 .

Carlos Z

Hey @Alfred_Castro, hope you are well.

Please take a look in this old reply which explain in details that exercise.

Carlos Z

npm install is a command that you use to install all the dependecies from a package.json file, it should work same way in windows or appel (brew terminal i think it is on apple).

Carlos Z