dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: The js-interpreter restructures code, where can i find that?

  1. #1
    Join Date
    Apr 2017
    Posts
    5

    Question The js-interpreter restructures code, where can i find that?

    Hi guys,

    in a effort to write code as clean as possible, i'd like to see how the js interpreter restructures my code.

    Does anyone know where i could access that?


    For clarification, what i mean:

    Say you write a function and use a variable inside an if-statement, the interpreter, through "hoisting" takes the variable out of the if-statement and puts it at the beginning of the function.

    A function written like this:

    Code:
    function getValue(condition) {
    
        if (condition) {
            var value = "blue";
    
            ...
    with hoisting becomes:

    Code:
    function getValue(condition) {
    
        var value;
    
        if (condition) {
            value = "blue";
    
            ...

    This is what i'd like to see...

    Thanks for reading my post... cheers!

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    4,512
    First I have heard of an interpreter changing things...
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles