Not able to understand javascript

Hello @pathak.shreyas.s
the answer to your question is that visit google
and search for w3 schools javascript tutorial
the content there is well organized and explaines thoroughly. the average lookup time is like 5-15 hours and kaboom you can master basics of javascript
also go through
https://www.youtube.com/watch?v=PODgPW-hbfU
hope this all stuff helps you

Firstly you again start with javascript topic and do whatever the bolt is telling you to do. If then, you are not getting the topic you can take help of forum.bolt.iot or you can take the help of external source such as google and youtube

1.U can write the code in SUBLIME Text or can u can also use notepad++ and save the file with .js extension.
In HTML u have to mention the js file name in the script tag of html.
If u want u can write both html and javascript in the same file but you have to add the tag called and write the javascript code in script tag.
3.You have to open the html file and right click and click on inspect.You can see the output for the javascript code in the console.

Hi @pathak.shreyas.s

Can you share the screenshot of your updated js and html code ?

1.Open your text editor and click on open and select a new file.
2.Write your javascript code in new file
than press control+s and than save it with file name .js
3.After that open your .html file using browser
Hope this information is useful for you
NOTE-- USE .js to save the file

Itā€™s could be browser problem some browsers canā€™t alow javascript but in chrome itā€™s work fine
You can save those file in one file
Like
indent preformatted text by 4 spaces

.... try this if any problem tell me i will share some codes like

java script is simple like extra feature of html with script tags. In this we have to save file with .js extension where the variables are used and reusable code.
first create a file and save it as .js.
then right click on the saved file select open with chrome or whatever.
then whatever you give input to the script tag that will be displayed in the browser.

Open your text editor and select a new file
write your javascript code in new file and save it with file name .js
after that open your .html file using browser.
Prior to this you should have written a code on html with .html extension in this file you should give javascript address so that it can access itā€¦
If you would like to learn more about it then visit w3school website
I hope you have understood it clearly

Hello,@ pathak.shreyas.s
Donā€™t worry.In this course you will be studying about HTML and javascript.If u are not able to follow those too or if u want to know more about js or html or any kind of those stuff u can refer www.w3schools.com.From here, u can learn from the basics to higher extent of building a website.Appreciating your enthusiasm on not giving up.Hope it is useful.

Its pretty simple!
Write HTML code as written in tutoral.
Go to Save As -> demo.html(select all files from drop down)
Write javascript as written in tutorial.
Go to Save As -> demo.js(select all files from drop down)
Voila. Youā€™re done.

To open an existing file, right click and select open as -> Notepad.

Kudos.
Rajat Kumar

  1. To write the code use sublime text only . Mine didnt work in the notepad so I used Sublime text.
  2. After writing the code go to ā€˜save asā€™ and name the file with extension .js (eg- file.js)
  3. Make a new file in sublime text and write the html code and save it the same way but with a .html extension.
  4. Open the file in browser. Right click then choose ā€˜inspectā€™ , there you can find the output in ā€˜consoleā€™.

@pathak.shreyas.s firstly goto your text editor and write the code as given in that chapter(variables in JS)then save that file with my-javascript.js then again create new file and write their html code as it is given in the chapter then save that with my-webpage.html ,in the same folder where you saved the .js file.
then open your webpage and then right on your browser window and select inspect and then console and you will get your desired output.

I think you have to link your javascript file in html file
e.g 1)save your html file with name file_name.html

Body content

2)then create another javascript file with name my_javascript.js and write following code in that file

alert(ā€œThis alert is coming from javascript fileā€);

3)Then open your html file in web browser
Note :save javascript file with extension .js only remove .htc

hopefully it works .

Hi @rahul.singh1

alert("This alert is coming from javascript file")

The JS code does not have a semicolon at the end. In the JS module, I have seen that most of the lines in JS have a semicolon at the end, except for the first line of the custom function declaration.

Is it fine to not use semicolons after the line?

Thanks in advance

Itā€™s not mandatory to put ; after line ending, the compiler can do it automatically for you. BUT, compiler can make mistakes if there is no new-line character, so it is good to be explicit rather than dependent on compiler to add ;.

1 Like

Understood. Thanks for your help @rajiv.sachdeva.

2 Likes

1)Write the JavaScript code as given in the chapter(Variables in JavaScript)
2)Click on Ctrl+S
NOTE:While saving the file remember that you have to use same name i.e.my-javascript.js as source file location in HTML file.
3)Create and save HTML file with .html extension i.e.my-webpage.html
4)Open file in browser >>Right click on webpage>>Click on inspect element>>Click on console and we have our results.
NOTE:If source code is not found
a)Check if both files are saved in same folder.
b)Check if in folder the .js file has the name my-javascript.js shown (as it should show only my-javascript).The reason for this is you might have saved JS code with wrong name i.e. .js must have been selected as file extension and you might have added .js while writing the name of JS file.If so, just rename it to*my-javascript * and you are good to go.I did this mistake myself and corecting it worked.

1 Like