Created
September 15, 2023 11:13
-
-
Save monish-khatri/1760e0b238fb3ed8dfbb7add4fe396c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const footballerStats = { | |
name: "Lionel Messi", | |
goals: 819, | |
assists: 344, | |
yellowCards: 96, | |
redCards: 2, | |
}; | |
// Freeze the footballer's stats to protect them from changes | |
Object.freeze (footballerStats); | |
// No opponent can alter these stats now, just like Messi's skills on the field! | |
footballerStats.goals = 750; // X Can't score more goals | |
footballerStats.yellowCards++; // X Can't receive more yellow cards | |
console.log(footballerStats); // Still the same unbreakable stats |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment