1

I'm learning Javascript

What is difference between these two codes as they both return the same output

var getcode = function(){
    var apicode = '0]Eal(eh&2';
    return apicode;
}
getcode();
var getCode = (function() {
  var apiCode = '0]Eal(eh&2';   

  return function() {
    return apiCode;
  };
})();

getCode();
Akash RP
  • 61
  • 5

0 Answers0