Skip to content

Instantly share code, notes, and snippets.

@monish-khatri
Created September 15, 2023 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monish-khatri/1760e0b238fb3ed8dfbb7add4fe396c9 to your computer and use it in GitHub Desktop.
Save monish-khatri/1760e0b238fb3ed8dfbb7add4fe396c9 to your computer and use it in GitHub Desktop.
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