Is there a mistake, in the console assignment?

In https://ivanontech.teachable.com/courses/287053/lectures/5280145 we get directed to the section https://www.digitalocean.com/community/tutorials/how-to-use-the-javascript-developer-console; There, the “## Working with an HTML File” mentions:
“Let’s take a blank HTML document, such as the following index.html file to understand how to use the Console to modify it:”. which is of course followed by the code.

Well, I tried to copy / paste this piece of code on to both Atom and Sublime text editors and in both cases when I save the code on the editors and then refresh the browser, sadly " Today's Date " doesn’t show. All I can see is a blank page, not the " Today's Date "
I then deleted the text of that code and just added the word “hi”, just to check out if “hi” will show when I refresh the browser. Sure enough the word “hi” shows fine when I refresh the browser.
When I tried to re-do the exercise /assignment ("## Working with an HTML File"), once again I only get a black page, not the " Today's Date " notification.
I then retried to add the word “hi” and once again, when I refresh the browser I can see the “hi” word.

So, is there a problem with the code in this assignment, or is it something else that I can’t figure out?
Thanks in advance.
George.

Hi George!

Please include the code that is not working for you. Screenshot of your code is best. Thanks!

1 Like

When I tried to send the original message WITH THE CODE included, it wouldn’t go through!! I don’t know why this is, but I tried several times, not just once. Then I decided to shorten the text have less digits on it, so it can go through. You are the creators of the toshi times site and you should know the answer as to why I encountered this problem. So I did not include the exact code but I’ve given a very very precise indication with regards to what you should look at (but you did not look at what I was pointing out). Probably you thought that I has been lazy, but I see that it is you that is being lazy here, not me.
Also keep in mind that I definitely could NOT attach anything as well (on that original email), it is only now with the second message that I have options available to me, including BOLD, Italic, attachments etc.
The first message was only allowing to send a part of the text that I have written. Nice site guys!
OK, here comes the the code attached, I don’t know if you are going to see the desired result when you run it through your editor, but I sure could not see what the instructions on that article were mentioning.
By the way your super buggy site, completely deleted my message to you, because I first wrote the message and then attached the picture, so I had to rewrite the message again from scratch. Nice job guys, I am impressed…

Georgios, this attitude is not accepted here.

If you don’t like the course or our community platform we are happy to give you your money back within 30 days of purchase. We have 11000+ students and no one has been this negative on the forum or to our support staff.

If you want to be in the academy and get help here on the community forum you have to be respectful. I’m happy to help you this time, but if you don’t change your attitude it’s needless to say that nobody will be thrilled to work with you.

Now let’s take a look at your code.

Today's date is written within the <title> tag. The text you write within <title> will not be shown on the page but instead in the tab bar of your window (see image).

1 Like

if you take the original message with the URL and try to send it you will have a problem doing so. I am not having a go, the form was not working properly. So don’t think I am too harsh on you.

Yes, I have figured that out. Indeed it would not show in the body of the page (inside the page), but it wouldn’t show in the tab bar either.

Alright that is strange, I see that the image you sent is not your code, but the code from the exercise, can you please send an image of your code in the way it looks in your text-editor? And also an image of your browser window when you open your HTML file.

1 Like

Atom%20console%20to%20Ghrome%20browser
Hi, if I understand what you say correctly:
I am putting the HTML from the exercise / assignment on to the editors (Atom, Sublime text). After I save by pressing the save button (I have also pressed Ctrl + S but everything was already saved), I hope that it will render,but still the two browser pages that are linked to the editors are opening as blank pages in Chrome.
Note that to be even able to link the editors to Chrome was a very hard task as my PC would not see Chrome as an option and was refusing to accept my instruction and switch from other programs or other browsers to Chrome. I really don’t know why this was happening and for so long as I was trying for days…
Anyway, I am attaching the 4 pictures and lets hope that we can get somewhere with those… Don’t get me wrong I still want to learn coding, so hopefully I will at some point :wink:
Thanks.

Hi Georgios

Thanks for the images.
The image of your Chrome Window is being cut off at the top.
Can you please include a picture that shows the tab-bar title?

This area is what I want to see:

That’s where the text “Today’s Date” should be displayed.

The rest of the page should be blank because your <body> tag is empty and that’s how it should be.

Thanks

1 Like

Hi Ivan.
After I received your email, I experimented by opening a Firefox browser and it shows on Firefox. Same goes with Opera, Brave and Internet Explorer browser.

On Chrome though, the only part that I can see is the part that I have sent you (the images that I have included on the Toshi Times forum), so sadly the tabs of “my” Chrome somehow DON’T show that upper side of the page where one can read the title of a web page. It is cut, it is removed, it is not there. I never knew that this thing can happen! Did I download a funny version of Chrome or what? How come this bizarre thing happened! Did anyone else ever had this problem with the upper side of the Chrome tabs being cut off??

Anyway that problem is solved; the code does work well and shows the title on every other browser. If you remember, I also had problems linking Chrome to the text editors, so I really wonder why all these things happen with my version of the Chrome browser. I should probably stop working with Chrome or maybe download a newer version? The one that I have was installed back in January 2017. It is the 71.0.3578.98 version.

So I am sorry for wasting your time on this because of the Chrome browser!!!

Hopefully I can go back to the console page and do the other assignments without having anything unforeseen or even my own lack of understanding stopping me from going forward.

Let me try…aaaaah, problems again ha ha. I tried to do the next assignment on the https://www.digitalocean.com/community/tutorials/how-to-use-the-javascript-developer-console page and copy paste the code (see below) on the Sublime Text Editor as Atom now appears to have a problem and doesn’t work no matter how many times I close and re-open the program (see attachment). Maybe if I close and re-open the PC it will work again.

So, now the assignment code renders badly on Firefox but perfectly on Google Chrome!!!

So the assignment code is

  • let d = new Date();
  • document.body.innerHTML = "

    Today’s date is " + d + “

Please check the attachments I am sending you on how it looks on 1) Firefox’s console and 2) on Chrome’s console.

I also tried to check on Brave and Opera browsers, but I think that those two browsers don’t offer development tools.

Note that I can manually add code on the console section of the Chrome browser and it is not getting reject, BUT if I try to manually add code on the console section of the Firefox browser then the assignment code (or any other code or anything else that I type for that matter) is getting rejected and I get the error messages. So rendering to the Firefox console is not easy. I don’t know what will happen elsewhere on the Firefox development web console!

Now, all these are bizarre, and I don’t know if I should re-install one of the two browsers that offer development tools (get a newer version of both Firefox AND Chrome), or one of the two browsers, or none of the two, or maybe call a priest to perform an exorcism :wink: Would be “funny” to go for a newer version of those browsers and then have even more problems. Decisions, decisions ha?

Any suggestions welcome Ivan, (hopefully you will not suggest the exorcism option, but will not blame you if you do!)

Thanks.

G.

image
Virus-free. www.avg.com

image

Hi Georgios,

Good to hear that it works in Firefox, let’s use Firefox as your Google Chrome seems to have weird behaviour while based on what you write your Firefox is working as it should.

The assignment is showing you how to manipulate the webpage from the console.
You should paste the code in the console, not your text-editor.

If you don’t know how to open the console in Firefox, check the article and read the section called Working with the Console in a Browser.

See where the red arrow points in the picture below. That’s where you should write your code in this assignment.

That’s where you should enter:

let d = new Date();

and then press enter.

And then on the next line write

document.body.innerHTML = "<h1>Today's date is " + d + "</h1>";

and press enter.

When you do this the webpage will change and show today’s date.

Hi Ivan.
Maybe you missed that part of my message to you where I was saying that Firefox doesn’t appear to be working well. PLUS, in the Firefox console I do NOT even see the same things. I don’t see: Elements Console Sources Network Performance. If you check the screenshot that I have sent you on the previous email, I see: Inspector Console Debugger Style Editor etc.
Just have a look at the image that I have sent you in the previous mail. I was also saying that the browser doesn’t allow me to write anything, when I hit ENTER it will not bring the desired result.
I am very very sorry both for myself and for you guys that I have so many tech problems, but I don’t know how to solve them unless someone more techy than me, helps out and is patient enough to examine the problems.
You get me?
Thanks
G.

Hi Georgios,

You need to write the lines one by one, pressing enter after every line. Like Ivan described. In your picture showing the console you have copy and pasted both lines into the console at once. I hope that helps.

My Firefox console has a very erratic behaviour. I almost got it to work, but sometimes even when you have the right syntax, it returns an error. Check this out:

It doesn’t allow me to copy / paste, that’s for sure.
However it also forces me to write everything in one line because it returns a “Scam Warning” if I don’t or a Syntaxerror.
Plus have you seen that I see a different menu on my Firefox console?
Thanks.

Haha, the issue is that you keep declaring the same variable - which is not allowed in javascript. As the error message says “Redeclaration of let d”. If you want to redefine d you can write just

d = new Date();

or open and close the browser, which would reset all defined variables.

Also, don’t write both lines of code into one command. You need to write both line separetely, like I said in the previous comment.

If you have a problem with copying and pasting you can write them by hand instead. The firefox console you are using in the latest image should be fine.

I have done both things that you are mentioning on different occasions before. So I have closed the console and retried, but so far it doesn’t allow me to write anything in one go. If I write only one line of the two, it returns an error.
Yes, i write everything by hand now, that’s the only way it can work.
Will try to close the browser and start again, hopefully I will get one perfect result…

Yeah do that. I just tried it in firefox and worked fine. Not copy and pasting though. If you want to copy and paste into the firefox console you need to first enable that by writing “allow pasting” like it said in the error message.

Victory at last!! Lets see what fresh hell I encounter next.
Thanks for all the time and effort, this was helpful indeed…