How JavaScript code is executed?

var x = 10;function square(num) {
var ans = num * num;
return ans;
}
var square1 = square(x);
var square2 = square(6);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ayesha Malik

Ayesha Malik

I’m a full-time software engineer who loves sharing knowledge to help others become better developers.