Revisiting JavaScript

Discussion in 'JavaScript and AJAX' started by Sagar Jaybhay, Sep 25, 2019.

  1. Sagar Jaybhay

    Sagar Jaybhay New Member

    Joined:
    Jan 28, 2019
    Messages:
    29
    Likes Received:
    17
    Trophy Points:
    3
    Gender:
    Male
    Occupation:
    Sr. Software Developer
    Location:
    Pune
    Home Page:
    https://sagarjaybhay.net
    Uses of JavaScript
    1. Client-side validation: by using this application much more responsive and no need for the round trip on server.ex. Form-Validation by using client-side validation we reduce the round trips on a server which means we reduce the load on the server.
    2. To run the code JavaScript uses client machine processing power.
    3. With JavaScript, partial page updates are also possible without reloading an entire web form
    4. For animation also we can use JavaScript.
    Disadvantages of JavaScript
    1. Security: JavaScript runs on the client machine so hacker may use JavaScript to do a variety of things like tracking your browser history, stealing your password.
    2. Browser Compatibility: For the same piece of JavaScript code may be treated differently by a different browser. Example: innerText is supported by Chrome and IE but not Firefox.
    3. Code Always Visible: The biggest disadvantages is code always visible to everyone anyone can view JavaScript code.
    4. Stop Render: JavaScript single error can stop to render with the entire site. However, browsers are extremely tolerant of JavaScript errors.
    5. Disable JavaScript: If you disable JavaScript in the browser, the entire JavaScript code is not run.
    6. File Download: JavaScript file is download on the client machine so anyone can read the code and reuse it.
    Where should we put script tag in Html?
    The script tag should be placed in body or head section of Html page and in general <script> tag can be placed in the body of Html.

    If you placed <script> tag in head section of Html page then if your controls not loaded till now then your code might not work.

    Also another reason is that if you refer external JavaScript file and you refer this in head section so web browser not start their parsing of web-page till the external file completely download.

    It is better to place the <script> tag near closing body tag.

    Is JavaScript case sensitive language?
    Yes JavaScript is case sensitive language. Variable names, keywords, methods and object properties, and event handlers these all are case sensitive
     
    shabbir likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice