Skip to content

Commit

Permalink
Merge pull request #99 from thuongtruong1009/es6
Browse files Browse the repository at this point in the history
feat: add lession 05 + 06 to es6 lessions
  • Loading branch information
thuongtruong1009 authored Sep 7, 2022
2 parents 2d29882 + 0627901 commit d5ca05c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ES6/05_prevent-object-mutation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function freezeObj() {
const MATH_CONSTANTS = {
PI: 3.14
};
// Only change code below this line
Object.freeze(MATH_CONSTANTS);
// Only change code above this line
try {
MATH_CONSTANTS.PI = 99;
} catch(ex) {
console.log(ex);
}
return MATH_CONSTANTS.PI;
}
const PI = freezeObj();
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const magic = () => {
return new Date();
};

0 comments on commit d5ca05c

Please sign in to comment.