0

I'm wondering what curly brackets do inside a function.
I was checking lazy() which is one of function in React library, and found code like this:

function lazy(x) {
    var payload = {//some values};
    var lazyType = {//some values}; 
    {   // ???
         var defaultProps;
         var proptype;
         Object.defineProperties(lazyType, {
             defaultProps: {//codes}
             },
             propTypes: {//codes}
         });
    }  // ???
return lazyType;
}

I'm not sure how those curly brackets work or mean.. please help me to understand, thank you

Rounin
  • 27,134
  • 9
  • 83
  • 108
zityou hanne
  • 41
  • 1
  • 6
  • 3
    It's a statement block. In this particular case it is useless, but it can be useful when you use blockscoped variables. – trincot Jun 28 '22 at 08:15
  • Thank you for your comments. I could find what i was looking for and understand. Thank you very much!! – zityou hanne Jun 28 '22 at 08:21

0 Answers0