Monday, 12 June 2017

JavaScript and jQuery



In website development, developers use JavaScript and JQuery to improve their website by adding functionality. In this document I will describe the advantage of using JavaScript and JQuery in website development, and how it can reduce, the build time of a website

JavaScript
JavaScript is a scripting language. JavaScript works in conjunction with HTML to make websites,
  HTML content and CSS more interactive . Although JavaScript is a coding language, it is classified as a scripting language due to the fact, it has limitations of what it can perform. This is because it is a security risk, where coders could create malicious code, to affect your computer such as erase the hard drive.JavaScript is an open source client side language that has various functions in HTML, such as creating high responsive interfaces, and is compatible with all browsers. JavaScript can be used for validation on forms and data entry, e.g. checking all field are filled in. which speeds up loading times on a website, and reduces bandwidth use on the server; this works by checking the information on the page, before sending it to the server. If JavaScript is was not used, the server would be checking the information and sending the page back to user if any entries are incorrect, which uses up bandwidth. and slows loading times.
This can be useful on e-commerce website such as Amazon and Ebay, as it be used to update information in real time e.g. deleting items in baskets. JavaScript consists of variables and parameters to perform certain actions such as calculations from user entry and store store user entry for use on a different page.Apart from performing actions, JavaScript is mostly used for adding interactivity. This includes: buttons,rollovers, carousel.





















The image above shows an example of JavaScript for a simple addition. It uses variables to assign values. For example the code is written under a script tag. It uses "var" to set variables, in the example above the variables are "5" and "6".When the script is run the values for "x" and "y" will be added to give you the z, in this case "5+6=11"



JQuery
jQuery is a library of JavaScript code, that is open source. This library is very useful for developers as it can speed up time of creating java script code, because they can use code that is in the library. For example if a developer wanted to add code for a resize able box, they can add the code from the library, instead of writing it from scratch. JQuery is versatile as it contains code for various purposes such as, HTML animating,  optimizing file upload through drag&drop. JQuery is useful when working with JavaScript, as  the developer is only required to write a few lines of code, that link the function to the external sheet, compared to writing a lot of lines for a function. Because this open source, developers can use them in any way without getting in trouble.








The image above is an example of how jQuery is implemented in HTML. The source for the function is linked to a server, where the JavaScript code is stored. Using jQuery is much simpler, as you are only required to have the page link of where it's stored. From the code, you can, see that the code in written under a script tag, and uses a click function. When you click on the paragraph, the following text will be hidden.





Refrences
https://www.w3schools.com/jquery/jquery_intro.asp
http://study.com/academy/lesson/what-is-javascript-function-uses-quiz.html
https://www.w3schools.com/jquery/jquery_selectors.asp
http://study.com/academy/lesson/what-is-javascript-function-uses-quiz.html

No comments:

Post a Comment