It’ll still work ie. the code will still get submitted even with the type error.
The reason for it is because you can’t do Object.freeze on const (Don’t ask me why. Please respond if you find the reason.) . Found a Medium article regarding similar thing.
In my opinion [TypeError: “PI” is read-only] in that case is not an error but the expected output when trying to assign a new value to a “const”. It means simply your code works und therefore has been submitted!
Such and similar Exceptions in Javascript are called “TypeError”!
Try also to execute the code without ‘use strict’ or without "try.{…} catch {…} to see the difference!
“use strict” is that so called strict or safe mode in Javascript. It allows you to detect errors and correct them. Such errors that are not allowed could be:
Use of undeclared variables.
Use of Javascript keywords as variable names
Duplicating parameters.
Deleting parameters or functions.
And others…
I recommend you the youtube video:
“Strict Mode — “use strict” - Beau teaches JavaScript”
from freeCodeCamp.