If you are writing big code it is very helpful write comments to the segment of the code as comment will not be executed, it is for codemasters to check where and which segment is located. Learning HTML is not the sole discretion of programmers as the trend can be seen it is been learnt by many bloggers and webmasters.
The sole purpose for this is to make it more and more convenience and to customize the web page to its fullest extent all by it self as with this knowledge in your kitty , you can reduce the cost factor as you can make the coding and with the advent of modern web technologies . With the advance modern web , where you can find more and more use of API and other related applications and with due course of time even the web page is fast becoming one of the conglomerate of applications visibility.
How Java Script works:
Java script is an interpreted languages and the browser interprets it and processed all the information in real time by contacting all server files and then interpret and shows it on your web page. You can change the value of variables at any time s the name suggests it is dynamic in nature; all variables need a declaration – that is you have to tell the interpreter what to treat as variable.
Functions are blocks of code, once written can be used as many times as declared within the program. If you want to add the functionality of Add and Print, then you could write a function called AddAndPrint and so on. It is useful for more complex coding as it can supplement easily for hundreds lines of code and that can reduce the overall size of the code.
That is why, it is good to use functions if you are using and coding long and in this manner it does makes the code small and precise. Object, in programs represent physical entitles, complete with their attributes and behaviours. The objects you will encounter when writing Java Script code will include the browser window- you can use the command to open the window. Everything else is also an object- be it text boxes, images, even your mouse cursor.
Java Script code is always enclosed in the <script> tags inside your HTML document. You can insert code blocks anywhere in the document, but it is always good practice to enclose your script within the <head> tags of the HTML. This way, the script will always be loaded before it gets used within the page. There are no semicolons at the end of each line. They are purely optional, and there so that C programmers do not suddenly feel out of their elements when writing Java Script.
Variables in Java Script can be declared by using “var” statement. The switch statement takes the variable browser and compares it one by one to the values mentioned in the case statements. The break statement prevents the browser from executing the very next line of code and tells it to exit the switch block.
There is one different way you can check your conditions in Java Script- this one specifically if you want to assign a value to a variable based in a condition. Programming loops let you execute the same block of code over and over again as many times as you like. The simplest example would be printing the numbers 1 to 10 or 1 to 100. The for loop is typically used when you can predict exactly how many times a piece of code. The while loop effectively tells your browser as long as this condition is true keep executing this block of code. You would typically use a while loop to check a condition rather than execute code a specific number of times this reducing the page load times.