Skip to content

Executable coding blocks production-readiness - PR 2 #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Mar 9, 2025

Conversation

tahachm
Copy link
Contributor

@tahachm tahachm commented Mar 7, 2025

Note: This is a stacked PR based off the earlier Executable coding blocks production-readiness - PR 1.

Adjusted code blocks for a further 34 questions to allow live execution.

  • Added console.log statements to allow learners to correlate the code outcomes by running the cell
  • codeblocks involving async functions like setTimeout() and promises have been left non-executable
  • Enhanced clarity in examples. I vetted the examples and improved some where I felt necessary
  • Refactored some async examples to be synchronous while retaining learning outcomes.
  • other minor errors in the code samples like syntax issues and undefined properties were also resolved.

Major issues encountered:

  • async code
  • lodash and module import examples left non-executable
  • Examples requiring DOM need to be addressed still
  • identified an issue with a codeblock related to inheriting the lexical scope of the code editing function

tahachm and others added 30 commits March 2, 2025 17:57
…or-undeclared-how-would-you-go-about-checking-for-any-of-these-states
…ax-how-does-this-new-syntax-differ-from-other-functions
tahachm added 20 commits March 7, 2025 02:42
@tahachm tahachm requested a review from yangshun March 7, 2025 20:50
@@ -86,7 +88,7 @@ const sayHello = () => 'Hello, World!';

Arrow functions cannot be used as constructors and will throw an error when used with the `new` keyword.

```js
```js live
const Foo = () => {};
const foo = new Foo(); // TypeError: Foo is not a constructor
```
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for console.log(arguments), the lexical scope of our runCode functions is being inherited, and thus the TypeError is not being thrown. Rather, we just get an empty object {} which are the empty arguments of our runCode function simply. Therefore, have left this codeblock unexecutable. Any ideas? I tried using globalThis but that would mess with other examples then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can leave it

@tahachm tahachm self-assigned this Mar 7, 2025
Base automatically changed from taha/executable-coding-blocks to main March 9, 2025 01:18
@yangshun yangshun merged commit 86b341e into main Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants