I was going through react library code. After going through I found a special piece of code I am unable to understand its significance. Can someone help?
var validateFormat = function () {};
{
validateFormat = function (format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
Here why react developer has wrapped the validateFormat into curly braces? is there any significance of doing this.
If I do the following it works the same -
var validateFormat = function () {};
validateFormat = function (format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};