Skip to content
loading...

Which one is valid ? How can answer 15 for both ?

momin profile image Md Abdul Momin github logo ・1 min read  

01


function doSomething(a) {
    b = a + doSomethingElse( a * 2 );

    console.log( b * 3 );
}

function doSomethingElse(a) {
    return a - 1;
}

var b;

doSomething( 2 ); // 15

02

function doSomething(a) {
    function doSomethingElse(a) {
        return a - 1;
    }

    var b;

    b = a + doSomethingElse( a * 2 );

    console.log( b * 3 );
}

doSomething( 2 ); // 15
twitter logo DISCUSS
Discussion
markdown guide
Classic DEV Post from Jan 25 '19

Applying Styles Based on the User Scroll Position with Smart CSS

Leverage the CSS attribute selector and scroll event to style elements based on the current scroll position on the page

Md Abdul Momin profile image
I'm a Front-End Software engineer who will be responsible for the complete lifecycle of scalable, secure, and well-designed software products from research and design to implementation.