Javascript hoisting example


Octocat **Promotion** - Efficiently manage your coding bookmarks, aka #codingmarks, on www.codingmarks.org and share your hidden gems with the world. They are published weekly on Github. You can help us build THE programming-resources location - Star


<head>
<title>Hoisting example</title>
</head>
<body>
    <h1>Hoisting in action</h1>
    <script type="application/javascript">
        var hoisting = "global variable";
        (function(){
            confirm("\"" + hoisting + "\"" + " click OK" );
            var hoisting = "local variable";
            alert(hoisting);
        })(); //self-executing function 

     //Best practice - declare local variables at the beginning of the function 
    </script>
</body>

New codingmarks published in week 48 of 2018

New codingmarks published in week 48 of 2018. Keywords: android, angular, api, documentation, feign, graphql, http, http-client, http2, https, java, kotlin, mapper, mapping, odata, rest, rest-client, spring, spring-boot and swagger Continue reading

New codingmarks published in week 46 of 2018

Published on November 20, 2018

New codingmarks published in week 45of 2018

Published on November 13, 2018