Skip to content

Instantly share code, notes, and snippets.

@leegeunhyeok
Last active February 24, 2020 07:15
Show Gist options
  • Save leegeunhyeok/d7e483cd8c0d8dc2b0fc8bb3d7cd0a1b to your computer and use it in GitHub Desktop.
Save leegeunhyeok/d7e483cd8c0d8dc2b0fc8bb3d7cd0a1b to your computer and use it in GitHub Desktop.
What is self in javascript?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>self</title>
</head>
<body>
</body>
<script>
const worker = new Worker('worker.js');
console.log('1:', self); // window
</script>
</html>
console.log('2:', self); // WorkerGlobalScope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment