Created
February 21, 2024 05:17
-
-
Save tgrecojs/4e84757b5b34359fdfaa95b5c2f8d6ed to your computer and use it in GitHub Desktop.
This file contains hidden or 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 c = new Compartment({ console, Math: { log2: Math.log2 }); | |
c.evaluate( | |
` | |
console.log('---------------') | |
console.group('---- inside compartment ----') | |
console.log('---------------') | |
const num = 10; | |
console.log('num', num); | |
console.log('---------------') | |
const result = Math.log2(num); | |
console.log('result', num); | |
console.groupEnd(); | |
return { result } | |
` | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment