+ + +
diff --git a/.cspell.json b/.cspell.json index 8872cb0..724752e 100644 --- a/.cspell.json +++ b/.cspell.json @@ -1,13 +1,13 @@ { - "language": "en", - "words": [ - "asdf", - "hackyourfuture", - "monospace", - "Precourse", - "distractor", - "distractors", - "typeof" - ], - "ignorePaths": ["node_modules/**", "**/*.json", "**/*.mp4", "**/*.svg"] + "language": "en", + "words": [ + "asdf", + "hackyourfuture", + "monospace", + "Precourse", + "distractor", + "distractors", + "typeof" + ], + "ignorePaths": ["node_modules/**", "**/*.json", "**/*.mp4", "**/*.svg"] } diff --git a/.eslintrc.json b/.eslintrc.json index 50a194b..b7ea4a8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,111 +1,111 @@ { - "plugins": ["prettier", "jsdoc", "prefer-arrow", "sonarjs", "jest"], - "env": { - "browser": false - }, - "parserOptions": { - "ecmaVersion": 2021, - "sourceType": "script" - }, - "globals": { - "prompt": false, - "alert": false, - "confirm": false, - "console": false - }, - "extends": [ - "eslint:recommended", - "prettier", - "airbnb-base", - "plugin:sonarjs/recommended" - ], - "overrides": [ - { - "files": ["**.test.js", "**.spec.js"], - "rules": { - "no-magic-numbers": 0 - }, - "env": { - "jest": true - } - } - ], - "rules": { - "no-var": 1, - "prefer-const": 0, - "no-extra-parens": 1, - "no-unreachable-loop": 1, - "eqeqeq": 1, - "no-implicit-coercion": 1, - "no-implicit-globals": 1, - "no-lone-blocks": 1, - "no-return-assign": 1, - "no-unused-expressions": 1, - "no-useless-computed-key": 1, - "no-useless-rename": 1, - "no-label-var": 1, - "no-shadow": 1, - "no-undefined": 1, - "arrow-parens": 1, - "arrow-body-style": 0, - "no-confusing-arrow": 1, - "vars-on-top": 0, - "no-plusplus": 0, - "guard-for-in": 0, - "no-unmodified-loop-condition": 0, - "no-warning-comments": 1, - "prefer-destructuring": 1, - "no-nested-ternary": 0, - "no-empty": 0, - "no-constant-condition": 0, - "no-alert": 0, - "no-console": 0, - "no-continue": 0, - "no-underscore-dangle": 0, - "strict": [2, "global"], - "no-multiple-empty-lines": 0, - "no-restricted-syntax": [ - 0, - { - "selector": "ForInStatement" - }, - { - "selector": "ForOfStatement" - } - ], - "camelcase": [2, { "properties": "never" }], + "plugins": ["prettier", "jsdoc", "prefer-arrow", "sonarjs", "jest"], + "env": { + "browser": false + }, + "parserOptions": { + "ecmaVersion": 2021, + "sourceType": "script" + }, + "globals": { + "prompt": false, + "alert": false, + "confirm": false, + "console": false + }, + "extends": [ + "eslint:recommended", + "prettier", + "airbnb-base", + "plugin:sonarjs/recommended" + ], + "overrides": [ + { + "files": ["**.test.js", "**.spec.js"], + "rules": { + "no-magic-numbers": 0 + }, + "env": { + "jest": true + } + } + ], + "rules": { + "no-var": 1, + "prefer-const": 0, + "no-extra-parens": 1, + "no-unreachable-loop": 1, + "eqeqeq": 1, + "no-implicit-coercion": 1, + "no-implicit-globals": 1, + "no-lone-blocks": 1, + "no-return-assign": 1, + "no-unused-expressions": 1, + "no-useless-computed-key": 1, + "no-useless-rename": 1, + "no-label-var": 1, + "no-shadow": 1, + "no-undefined": 1, + "arrow-parens": 1, + "arrow-body-style": 0, + "no-confusing-arrow": 1, + "vars-on-top": 0, + "no-plusplus": 0, + "guard-for-in": 0, + "no-unmodified-loop-condition": 0, + "no-warning-comments": 1, + "prefer-destructuring": 1, + "no-nested-ternary": 0, + "no-empty": 0, + "no-constant-condition": 0, + "no-alert": 0, + "no-console": 0, + "no-continue": 0, + "no-underscore-dangle": 0, + "strict": [2, "global"], + "no-multiple-empty-lines": 0, + "no-restricted-syntax": [ + 0, + { + "selector": "ForInStatement" + }, + { + "selector": "ForOfStatement" + } + ], + "camelcase": [2, { "properties": "never" }], - "prettier/prettier": ["error"], + "prettier/prettier": ["error"], - "sonarjs/prefer-immediate-return": 0, + "sonarjs/prefer-immediate-return": 0, - "jsdoc/check-alignment": 1, - "jsdoc/check-indentation": 1, - "jsdoc/check-line-alignment": 1, - "jsdoc/check-param-names": 1, - "jsdoc/check-syntax": 1, - "jsdoc/check-tag-names": 1, - "jsdoc/check-types": 1, - "jsdoc/check-values": 1, - "jsdoc/empty-tags": 1, - "jsdoc/newline-after-description": 1, - "jsdoc/no-bad-blocks": 1, - "jsdoc/no-undefined-types": 1, - "jsdoc/require-description": 1, - "jsdoc/require-description-complete-sentence": 1, - "jsdoc/require-hyphen-before-param-description": 1, - "jsdoc/require-jsdoc": 1, - "jsdoc/require-param": 1, - "jsdoc/require-param-description": 1, - "jsdoc/require-param-name": 1, - "jsdoc/require-param-type": 1, - "jsdoc/require-returns": 1, - "jsdoc/require-returns-check": 1, - "jsdoc/require-returns-description": 1, - "jsdoc/require-returns-type": 1, - "jsdoc/require-throws": 1, - "jsdoc/require-yields": 1, - "jsdoc/require-yields-check": 1, - "jsdoc/valid-types": 1 - } + "jsdoc/check-alignment": 1, + "jsdoc/check-indentation": 1, + "jsdoc/check-line-alignment": 1, + "jsdoc/check-param-names": 1, + "jsdoc/check-syntax": 1, + "jsdoc/check-tag-names": 1, + "jsdoc/check-types": 1, + "jsdoc/check-values": 1, + "jsdoc/empty-tags": 1, + "jsdoc/newline-after-description": 1, + "jsdoc/no-bad-blocks": 1, + "jsdoc/no-undefined-types": 1, + "jsdoc/require-description": 1, + "jsdoc/require-description-complete-sentence": 1, + "jsdoc/require-hyphen-before-param-description": 1, + "jsdoc/require-jsdoc": 1, + "jsdoc/require-param": 1, + "jsdoc/require-param-description": 1, + "jsdoc/require-param-name": 1, + "jsdoc/require-param-type": 1, + "jsdoc/require-returns": 1, + "jsdoc/require-returns-check": 1, + "jsdoc/require-returns-description": 1, + "jsdoc/require-returns-type": 1, + "jsdoc/require-throws": 1, + "jsdoc/require-yields": 1, + "jsdoc/require-yields-check": 1, + "jsdoc/valid-types": 1 + } } diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ed46fd0..b13df35 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,12 +9,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: npm install - - run: npm run format:check - - run: npm run lint:ls - run: npm run lint:md - run: npm run lint:js diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc index 0b80f38..b7f0923 100644 --- a/.markdownlint.jsonc +++ b/.markdownlint.jsonc @@ -1,250 +1,250 @@ { - // Example markdownlint JSON(C) configuration with all properties set to their default value - - // Default state for all rules - "default": true, - - // MD001/heading-increment/header-increment - Heading levels should only increment by one level at a time - "MD001": true, - - // Deprecated and disabled - // MD002/first-heading-h1/first-header-h1 - First heading should be a top-level heading - // "MD002": { - // // Heading level - // "level": 1 - // }, - - // MD003/heading-style/header-style - Heading style - "MD003": { - // Heading style - "style": "consistent" - }, - - // MD004/ul-style - Unordered list style - "MD004": { - // List style - "style": "consistent" - }, - - // MD005/list-indent - Inconsistent indentation for list items at the same level - "MD005": true, - - // Deprecated and disabled - // MD006/ul-start-left - Consider starting bulleted lists at the beginning of the line - // "MD006": true, - - // MD007/ul-indent - Unordered list indentation - "MD007": { - // Spaces for indent - "indent": 2, - // Whether to indent the first level of the list - "start_indented": false - }, - - // MD009/no-trailing-spaces - Trailing spaces - "MD009": { - // Spaces for line break - "br_spaces": 2, - // Allow spaces for empty lines in list items - "list_item_empty_lines": false, - // Include unnecessary breaks - "strict": false - }, - - // MD010/no-hard-tabs - Hard tabs - "MD010": { - // Include code blocks - "code_blocks": true - }, - - // MD011/no-reversed-links - Reversed link syntax - "MD011": true, - - // MD012/no-multiple-blanks - Multiple consecutive blank lines - "MD012": { - // Consecutive blank lines - "maximum": 1 - }, - - // MD013/line-length - Line length - "MD013": { - // Number of characters - "line_length": 120, - // Number of characters for headings - "heading_line_length": 80, - // Number of characters for code blocks - "code_block_line_length": 80, - // Include code blocks - "code_blocks": false, - // Include tables - "tables": false, - // Include headings - "headings": true, - // Include headings - "headers": true, - // Strict length checking - "strict": false, - // Stern length checking - "stern": false - }, - - // MD014/commands-show-output - Dollar signs used before commands without showing output - "MD014": true, - - // MD018/no-missing-space-atx - No space after hash on atx style heading - "MD018": true, - - // MD019/no-multiple-space-atx - Multiple spaces after hash on atx style heading - "MD019": true, - - // MD020/no-missing-space-closed-atx - No space inside hashes on closed atx style heading - "MD020": true, - - // MD021/no-multiple-space-closed-atx - Multiple spaces inside hashes on closed atx style heading - "MD021": true, - - // MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines - "MD022": { - // Blank lines above heading - "lines_above": 1, - // Blank lines below heading - "lines_below": 1 - }, - - // MD023/heading-start-left/header-start-left - Headings must start at the beginning of the line - "MD023": true, - - // MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content - "MD024": { - // Only check sibling headings - "allow_different_nesting": true, - // Only check sibling headings - "siblings_only": true - }, - - // MD025/single-title/single-h1 - Multiple top-level headings in the same document - "MD025": { - // Heading level - "level": 1, - // RegExp for matching title in front matter - "front_matter_title": "^\\s*title\\s*[:=]" - }, - - // MD026/no-trailing-punctuation - Trailing punctuation in heading - "MD026": { - // Punctuation characters - "punctuation": ".,;:!。,;:!" - }, - - // MD027/no-multiple-space-blockquote - Multiple spaces after blockquote symbol - "MD027": true, - - // MD028/no-blanks-blockquote - Blank line inside blockquote - "MD028": true, - - // MD029/ol-prefix - Ordered list item prefix - "MD029": { - // List style - "style": "one_or_ordered" - }, - - // MD030/list-marker-space - Spaces after list markers - "MD030": { - // Spaces for single-line unordered list items - "ul_single": 1, - // Spaces for single-line ordered list items - "ol_single": 1, - // Spaces for multi-line unordered list items - "ul_multi": 1, - // Spaces for multi-line ordered list items - "ol_multi": 1 - }, - - // MD031/blanks-around-fences - Fenced code blocks should be surrounded by blank lines - "MD031": { - // Include list items - "list_items": true - }, - - // MD032/blanks-around-lists - Lists should be surrounded by blank lines - "MD032": true, - - // MD033/no-inline-html - Inline HTML - "MD033": { - // Allowed elements - "allowed_elements": ["summary", "details", "br", "strong", "code", "a"] - }, - - // MD034/no-bare-urls - Bare URL used - "MD034": true, - - // MD035/hr-style - Horizontal rule style - "MD035": { - // Horizontal rule style - "style": "consistent" - }, - - // MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading - "MD036": { - // Punctuation characters - "punctuation": ".,;:!?。,;:!?" - }, - - // MD037/no-space-in-emphasis - Spaces inside emphasis markers - "MD037": true, - - // MD038/no-space-in-code - Spaces inside code span elements - "MD038": true, - - // MD039/no-space-in-links - Spaces inside link text - "MD039": true, - - // MD040/fenced-code-language - Fenced code blocks should have a language specified - "MD040": true, - - // MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading - "MD041": { - // Heading level - "level": 1, - // RegExp for matching title in front matter - "front_matter_title": "^\\s*title\\s*[:=]" - }, - - // MD042/no-empty-links - No empty links - "MD042": true, - - // MD043/required-headings/required-headers - Required heading structure - "MD043": false, - // { - // // List of headings - // "headings": [], - // // List of headings - // "headers": [] - // }, - - // MD044/proper-names - Proper names should have the correct capitalization - "MD044": { - // List of proper names - "names": [], - // Include code blocks - "code_blocks": true - }, - - // MD045/no-alt-text - Images should have alternate text (alt text) - "MD045": true, - - // MD046/code-block-style - Code block style - "MD046": { - // Block style - "style": "consistent" - }, - - // MD047/single-trailing-newline - Files should end with a single newline character - "MD047": true, - - // MD048/code-fence-style - Code fence style - "MD048": { - // Code fence style - "style": "consistent" - } + // Example markdownlint JSON(C) configuration with all properties set to their default value + + // Default state for all rules + "default": true, + + // MD001/heading-increment/header-increment - Heading levels should only increment by one level at a time + "MD001": true, + + // Deprecated and disabled + // MD002/first-heading-h1/first-header-h1 - First heading should be a top-level heading + // "MD002": { + // // Heading level + // "level": 1 + // }, + + // MD003/heading-style/header-style - Heading style + "MD003": { + // Heading style + "style": "consistent" + }, + + // MD004/ul-style - Unordered list style + "MD004": { + // List style + "style": "consistent" + }, + + // MD005/list-indent - Inconsistent indentation for list items at the same level + "MD005": true, + + // Deprecated and disabled + // MD006/ul-start-left - Consider starting bulleted lists at the beginning of the line + // "MD006": true, + + // MD007/ul-indent - Unordered list indentation + "MD007": { + // Spaces for indent + "indent": 2, + // Whether to indent the first level of the list + "start_indented": false + }, + + // MD009/no-trailing-spaces - Trailing spaces + "MD009": { + // Spaces for line break + "br_spaces": 2, + // Allow spaces for empty lines in list items + "list_item_empty_lines": false, + // Include unnecessary breaks + "strict": false + }, + + // MD010/no-hard-tabs - Hard tabs + "MD010": { + // Include code blocks + "code_blocks": true + }, + + // MD011/no-reversed-links - Reversed link syntax + "MD011": true, + + // MD012/no-multiple-blanks - Multiple consecutive blank lines + "MD012": { + // Consecutive blank lines + "maximum": 1 + }, + + // MD013/line-length - Line length + "MD013": { + // Number of characters + "line_length": 120, + // Number of characters for headings + "heading_line_length": 80, + // Number of characters for code blocks + "code_block_line_length": 80, + // Include code blocks + "code_blocks": false, + // Include tables + "tables": false, + // Include headings + "headings": true, + // Include headings + "headers": true, + // Strict length checking + "strict": false, + // Stern length checking + "stern": false + }, + + // MD014/commands-show-output - Dollar signs used before commands without showing output + "MD014": true, + + // MD018/no-missing-space-atx - No space after hash on atx style heading + "MD018": true, + + // MD019/no-multiple-space-atx - Multiple spaces after hash on atx style heading + "MD019": true, + + // MD020/no-missing-space-closed-atx - No space inside hashes on closed atx style heading + "MD020": true, + + // MD021/no-multiple-space-closed-atx - Multiple spaces inside hashes on closed atx style heading + "MD021": true, + + // MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines + "MD022": { + // Blank lines above heading + "lines_above": 1, + // Blank lines below heading + "lines_below": 1 + }, + + // MD023/heading-start-left/header-start-left - Headings must start at the beginning of the line + "MD023": true, + + // MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content + "MD024": { + // Only check sibling headings + "allow_different_nesting": true, + // Only check sibling headings + "siblings_only": true + }, + + // MD025/single-title/single-h1 - Multiple top-level headings in the same document + "MD025": { + // Heading level + "level": 1, + // RegExp for matching title in front matter + "front_matter_title": "^\\s*title\\s*[:=]" + }, + + // MD026/no-trailing-punctuation - Trailing punctuation in heading + "MD026": { + // Punctuation characters + "punctuation": ".,;:!。,;:!" + }, + + // MD027/no-multiple-space-blockquote - Multiple spaces after blockquote symbol + "MD027": true, + + // MD028/no-blanks-blockquote - Blank line inside blockquote + "MD028": true, + + // MD029/ol-prefix - Ordered list item prefix + "MD029": { + // List style + "style": "one_or_ordered" + }, + + // MD030/list-marker-space - Spaces after list markers + "MD030": { + // Spaces for single-line unordered list items + "ul_single": 1, + // Spaces for single-line ordered list items + "ol_single": 1, + // Spaces for multi-line unordered list items + "ul_multi": 1, + // Spaces for multi-line ordered list items + "ol_multi": 1 + }, + + // MD031/blanks-around-fences - Fenced code blocks should be surrounded by blank lines + "MD031": { + // Include list items + "list_items": true + }, + + // MD032/blanks-around-lists - Lists should be surrounded by blank lines + "MD032": true, + + // MD033/no-inline-html - Inline HTML + "MD033": { + // Allowed elements + "allowed_elements": ["summary", "details", "br", "strong", "code", "a"] + }, + + // MD034/no-bare-urls - Bare URL used + "MD034": true, + + // MD035/hr-style - Horizontal rule style + "MD035": { + // Horizontal rule style + "style": "consistent" + }, + + // MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading + "MD036": { + // Punctuation characters + "punctuation": ".,;:!?。,;:!?" + }, + + // MD037/no-space-in-emphasis - Spaces inside emphasis markers + "MD037": true, + + // MD038/no-space-in-code - Spaces inside code span elements + "MD038": true, + + // MD039/no-space-in-links - Spaces inside link text + "MD039": true, + + // MD040/fenced-code-language - Fenced code blocks should have a language specified + "MD040": true, + + // MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading + "MD041": { + // Heading level + "level": 1, + // RegExp for matching title in front matter + "front_matter_title": "^\\s*title\\s*[:=]" + }, + + // MD042/no-empty-links - No empty links + "MD042": true, + + // MD043/required-headings/required-headers - Required heading structure + "MD043": false, + // { + // // List of headings + // "headings": [], + // // List of headings + // "headers": [] + // }, + + // MD044/proper-names - Proper names should have the correct capitalization + "MD044": { + // List of proper names + "names": [], + // Include code blocks + "code_blocks": true + }, + + // MD045/no-alt-text - Images should have alternate text (alt text) + "MD045": true, + + // MD046/code-block-style - Code block style + "MD046": { + // Block style + "style": "consistent" + }, + + // MD047/single-trailing-newline - Files should end with a single newline character + "MD047": true, + + // MD048/code-fence-style - Code fence style + "MD048": { + // Code fence style + "style": "consistent" + } } diff --git a/.prettierrc.json b/.prettierrc.json index 275e80d..9f58447 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,9 +1,10 @@ { - "printWidth": 80, - "proseWrap": "always", - "trailingComma": "all", - "tabWidth": 2, - "semi": true, - "bracketSpacing": true, - "singleQuote": true + "printWidth": 80, + "proseWrap": "always", + "trailingComma": "all", + "tabWidth": 2, + "semi": true, + "bracketSpacing": true, + "singleQuote": true, + "useTabs": true } diff --git a/.vscode/extensions.json b/.vscode/extensions.json index c1593f7..3ddf265 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,35 +1,35 @@ { - // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. - // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp - // List of extensions which should be recommended for users of this workspace. - "recommendations": [ - "streetsidesoftware.code-spell-checker", - "dbaeumer.vscode-eslint", - "mhutchie.git-graph", - "donjayamanne.githistory", - "github.vscode-pull-request-github", - "eamodio.gitlens", - "anteprimorac.html-end-tag-labels", - "ritwickdey.liveserver", - "yzhang.markdown-all-in-one", - "davidanson.vscode-markdownlint", - "esbenp.prettier-vscode", - "alefragnani.project-manager", - "stylelint.vscode-stylelint", - "vscode-icons-team.vscode-icons", - "alefragnani.bookmarks", - "bierner.markdown-preview-github-styles", - "ecmel.vscode-html-css", - "htmlhint.vscode-htmlhint", - "pranaygp.vscode-css-peek", - "zignd.html-css-class-completion", - "juanallo.vscode-dependency-cruiser", - "visualstudioexptteam.vscodeintellicode", - "aaron-bond.better-comments", - "christian-kohler.path-intellisense", - "ms-vsliveshare.vsliveshare" - ], - // List of extensions recommended by VS Code that should not be recommended for users of this workspace. - "unwantedRecommendations": [] + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "streetsidesoftware.code-spell-checker", + "dbaeumer.vscode-eslint", + "mhutchie.git-graph", + "donjayamanne.githistory", + "github.vscode-pull-request-github", + "eamodio.gitlens", + "anteprimorac.html-end-tag-labels", + "ritwickdey.liveserver", + "yzhang.markdown-all-in-one", + "davidanson.vscode-markdownlint", + "esbenp.prettier-vscode", + "alefragnani.project-manager", + "stylelint.vscode-stylelint", + "vscode-icons-team.vscode-icons", + "alefragnani.bookmarks", + "bierner.markdown-preview-github-styles", + "ecmel.vscode-html-css", + "htmlhint.vscode-htmlhint", + "pranaygp.vscode-css-peek", + "zignd.html-css-class-completion", + "juanallo.vscode-dependency-cruiser", + "visualstudioexptteam.vscodeintellicode", + "aaron-bond.better-comments", + "christian-kohler.path-intellisense", + "ms-vsliveshare.vsliveshare" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 5a90e20..640d6ac 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,117 +1,117 @@ { - // https://vscode-docs.readthedocs.io/en/stable/customization/userandworkspace/#default-settings - //-------- Editor configuration -------- + // https://vscode-docs.readthedocs.io/en/stable/customization/userandworkspace/#default-settings + //-------- Editor configuration -------- - // Controls auto save of editors that have unsaved changes.: https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save - "files.autoSave": "onFocusChange", + // Controls auto save of editors that have unsaved changes.: https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save + "files.autoSave": "onFocusChange", - // Format a file on save. A formatter must be available. - "editor.formatOnSave": true, + // Format a file on save. A formatter must be available. + "editor.formatOnSave": true, - // Controls whether the editor should automatically format the pasted content. A formatter must be available. - "editor.formatOnPaste": true, + // Controls whether the editor should automatically format the pasted content. A formatter must be available. + "editor.formatOnPaste": true, - // Controls whether the editor should render indent quides - "editor.guides.indentation": true, + // Controls whether the editor should render indent quides + "editor.guides.indentation": true, - // Controls whether the editor should highlight the active indent guide. - "editor.guides.highlightActiveIndentation": true, + // Controls whether the editor should highlight the active indent guide. + "editor.guides.highlightActiveIndentation": true, - // Controls the rendering size of tabs in characters. Accepted values: "auto", 2, 4, 6, etc. If set to "auto", the value will be guessed when a file is opened. - "editor.tabSize": 2, + // Controls the rendering size of tabs in characters. Accepted values: "auto", 2, 4, 6, etc. If set to "auto", the value will be guessed when a file is opened. + "editor.tabSize": 2, - // Defines a default formatter which takes precedence over all other formatter settings. Must be the identifier of an extension contributing a formatter - "editor.defaultFormatter": "esbenp.prettier-vscode", + // Defines a default formatter which takes precedence over all other formatter settings. Must be the identifier of an extension contributing a formatter + "editor.defaultFormatter": "esbenp.prettier-vscode", - // Controls bracket pair colorization is enabled or not - "editor.bracketPairColorization.enabled": true, + // Controls bracket pair colorization is enabled or not + "editor.bracketPairColorization.enabled": true, - // Controls whether bracket pair guides are enabled or not. (true, active, false) - "editor.guides.bracketPairs": "active", + // Controls whether bracket pair guides are enabled or not. (true, active, false) + "editor.guides.bracketPairs": "active", - // Controls whether horizontal bracket pair guides are enabled or not. - "editor.guides.bracketPairsHorizontal": "active", + // Controls whether horizontal bracket pair guides are enabled or not. + "editor.guides.bracketPairsHorizontal": "active", - // Controls whether the editor should highlight the active bracket pair. - "editor.guides.highlightActiveBracketPair": true, + // Controls whether the editor should highlight the active bracket pair. + "editor.guides.highlightActiveBracketPair": true, - // Controls whether the editor has linked editing enabled. - "editor.linkedEditing": true, + // Controls whether the editor has linked editing enabled. + "editor.linkedEditing": true, - //-------- HTML configuration -------- + //-------- HTML configuration -------- - // Enable/disable auto closing of HTML tags - "html.autoClosingTags": true, + // Enable/disable auto closing of HTML tags + "html.autoClosingTags": true, - // Configures if the built-in HTML language suggests HTML5 tags, properties and values. - "html.suggest.html5": true, + // Configures if the built-in HTML language suggests HTML5 tags, properties and values. + "html.suggest.html5": true, - // Defines a default HTML formatter which takes precedence over all other formatter settings. Must be the identifier of an extension contributing a formatter - "[html]": { - "editor.defaultFormatter": "vscode.html-language-features" - }, + // Defines a default HTML formatter which takes precedence over all other formatter settings. Must be the identifier of an extension contributing a formatter + "[html]": { + "editor.defaultFormatter": "vscode.html-language-features" + }, - //-------- Emmet configuration -------- + //-------- Emmet configuration -------- - // Enables completion when you are writing Emmet appreveation. - "html-css-class-completion.enableEmmetSupport": true, + // Enables completion when you are writing Emmet appreveation. + "html-css-class-completion.enableEmmetSupport": true, - //-------- JavaScript configuration -------- + //-------- JavaScript configuration -------- - // Enable/disable auto closing of JSX tags. - "javascript.autoClosingTags": true, + // Enable/disable auto closing of JSX tags. + "javascript.autoClosingTags": true, - // Enable/disable auto import suggestions. - "javascript.suggest.autoImports": true, + // Enable/disable auto import suggestions. + "javascript.suggest.autoImports": true, - // Enable/disable automatic updating of import paths when you rename or move a file in VS Code. - "javascript.updateImportsOnFileMove.enabled": "always", + // Enable/disable automatic updating of import paths when you rename or move a file in VS Code. + "javascript.updateImportsOnFileMove.enabled": "always", - // Enable/disable suggestoins for paths in import statement and require calls. (change it to false to be able to use Path Intellisense extension) - "javascript.suggest.paths": false, + // Enable/disable suggestoins for paths in import statement and require calls. (change it to false to be able to use Path Intellisense extension) + "javascript.suggest.paths": false, - //-------- TypeScript configuration -------- + //-------- TypeScript configuration -------- - // Enable/disable auto closing of JSX tags. - "typescript.autoClosingTags": true, + // Enable/disable auto closing of JSX tags. + "typescript.autoClosingTags": true, - // Enable/disable auto import suggestions. - "typescript.suggest.autoImports": true, + // Enable/disable auto import suggestions. + "typescript.suggest.autoImports": true, - // Enable/disable automatic updating of import paths when you rename or move a file in VS Code. - "typescript.updateImportsOnFileMove.enabled": "always", + // Enable/disable automatic updating of import paths when you rename or move a file in VS Code. + "typescript.updateImportsOnFileMove.enabled": "always", - // Enable/disable suggestoins for paths in import statement and require calls. (change it to false to be able to use Path Intellisense extension) - "typescript.suggest.paths": false, + // Enable/disable suggestoins for paths in import statement and require calls. (change it to false to be able to use Path Intellisense extension) + "typescript.suggest.paths": false, - //-------- Work Bench configuration -------- + //-------- Work Bench configuration -------- - // Controls whether a top border is drawn on tabs for editors that have unsaved changes. - "workbench.editor.highlightModifiedTabs": true, + // Controls whether a top border is drawn on tabs for editors that have unsaved changes. + "workbench.editor.highlightModifiedTabs": true, - //-------- Files configuration -------- + //-------- Files configuration -------- - // When enabled, will trim all new lines after the final new line at the end of the file when saving it. - "files.trimFinalNewlines": true, + // When enabled, will trim all new lines after the final new line at the end of the file when saving it. + "files.trimFinalNewlines": true, - // When enabled, insert a new final line at the end of the file when saving it. - "files.insertFinalNewline": true, + // When enabled, insert a new final line at the end of the file when saving it. + "files.insertFinalNewline": true, - //-------- Live Server configuration -------- + //-------- Live Server configuration -------- - // Set Custom Port Number of Live Server. Set 0 if you want random port. - "liveServer.settings.port": 5504, + // Set Custom Port Number of Live Server. Set 0 if you want random port. + "liveServer.settings.port": 5504, - //-------- Markdown configuration -------- + //-------- Markdown configuration -------- - // Enable path suggestoins while writing links in markdown files - "markdown.suggest.paths.enabled": true, + // Enable path suggestoins while writing links in markdown files + "markdown.suggest.paths.enabled": true, - // Defines a default markdown formatter which takes precedence over all other formatter settings. Must be the identifier of an extension contributing a formatter - "[markdown]": { - "editor.defaultFormatter": "DavidAnson.vscode-markdownlint" - }, + // Defines a default markdown formatter which takes precedence over all other formatter settings. Must be the identifier of an extension contributing a formatter + "[markdown]": { + "editor.defaultFormatter": "DavidAnson.vscode-markdownlint" + }, - // Enable/disable update table of contents on save - "markdown.extension.toc.updateOnSave": false + // Enable/disable update table of contents on save + "markdown.extension.toc.updateOnSave": false } diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/study.json b/0-asserting/2-isolate/2-comparing-and-asserting/study.json deleted file mode 100644 index 38035ae..0000000 --- a/0-asserting/2-isolate/2-comparing-and-asserting/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "study": { - "trace": { - "variablesDeclare": false, - "variablesAssign": false, - "variablesRead": false - } - } -} diff --git a/0-asserting/2-isolate/study.json b/0-asserting/2-isolate/study.json deleted file mode 100644 index 8373169..0000000 --- a/0-asserting/2-isolate/study.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "study": { - "openIn": "jsTutorLive", - "ask": false - } -} diff --git a/0-asserting/README.md b/0-asserting/README.md deleted file mode 100644 index a175dc3..0000000 --- a/0-asserting/README.md +++ /dev/null @@ -1 +0,0 @@ -# Asserting diff --git a/0-asserting/0-comments-and-logs/README.md b/00-asserting/0-comments-and-logs/README.md similarity index 100% rename from 0-asserting/0-comments-and-logs/README.md rename to 00-asserting/0-comments-and-logs/README.md diff --git a/0-asserting/1-predicting-execution/README.md b/00-asserting/1-predicting-execution/README.md similarity index 100% rename from 0-asserting/1-predicting-execution/README.md rename to 00-asserting/1-predicting-execution/README.md diff --git a/0-asserting/1-predicting-execution/breakpoints.js b/00-asserting/1-predicting-execution/breakpoints.js similarity index 100% rename from 0-asserting/1-predicting-execution/breakpoints.js rename to 00-asserting/1-predicting-execution/breakpoints.js diff --git a/0-asserting/1-predicting-execution/debugger-statement.js b/00-asserting/1-predicting-execution/debugger-statement.js similarity index 100% rename from 0-asserting/1-predicting-execution/debugger-statement.js rename to 00-asserting/1-predicting-execution/debugger-statement.js diff --git a/0-asserting/1-predicting-execution/in-js-tutor.js b/00-asserting/1-predicting-execution/in-js-tutor.js similarity index 100% rename from 0-asserting/1-predicting-execution/in-js-tutor.js rename to 00-asserting/1-predicting-execution/in-js-tutor.js diff --git a/0-asserting/1-predicting-execution/in-the-devtools.js b/00-asserting/1-predicting-execution/in-the-devtools.js similarity index 100% rename from 0-asserting/1-predicting-execution/in-the-devtools.js rename to 00-asserting/1-predicting-execution/in-the-devtools.js diff --git a/0-asserting/2-isolate/1-variables/README.md b/00-asserting/2-isolate/1-variables/README.md similarity index 100% rename from 0-asserting/2-isolate/1-variables/README.md rename to 00-asserting/2-isolate/1-variables/README.md diff --git a/0-asserting/2-isolate/1-variables/examples/1-declaration-assignment-reassignment.js b/00-asserting/2-isolate/1-variables/examples/1-declaration-assignment-reassignment.js similarity index 100% rename from 0-asserting/2-isolate/1-variables/examples/1-declaration-assignment-reassignment.js rename to 00-asserting/2-isolate/1-variables/examples/1-declaration-assignment-reassignment.js diff --git a/0-asserting/2-isolate/1-variables/examples/2-reusing-variables.js b/00-asserting/2-isolate/1-variables/examples/2-reusing-variables.js similarity index 100% rename from 0-asserting/2-isolate/1-variables/examples/2-reusing-variables.js rename to 00-asserting/2-isolate/1-variables/examples/2-reusing-variables.js diff --git a/0-asserting/2-isolate/1-variables/examples/3-const-vs-let.js b/00-asserting/2-isolate/1-variables/examples/3-const-vs-let.js similarity index 100% rename from 0-asserting/2-isolate/1-variables/examples/3-const-vs-let.js rename to 00-asserting/2-isolate/1-variables/examples/3-const-vs-let.js diff --git a/0-asserting/2-isolate/1-variables/exercises/1-let.js b/00-asserting/2-isolate/1-variables/exercises/1-let.js similarity index 100% rename from 0-asserting/2-isolate/1-variables/exercises/1-let.js rename to 00-asserting/2-isolate/1-variables/exercises/1-let.js diff --git a/0-asserting/2-isolate/1-variables/exercises/2-let.js b/00-asserting/2-isolate/1-variables/exercises/2-let.js similarity index 100% rename from 0-asserting/2-isolate/1-variables/exercises/2-let.js rename to 00-asserting/2-isolate/1-variables/exercises/2-let.js diff --git a/0-asserting/2-isolate/1-variables/exercises/3-let-or-const.js b/00-asserting/2-isolate/1-variables/exercises/3-let-or-const.js similarity index 100% rename from 0-asserting/2-isolate/1-variables/exercises/3-let-or-const.js rename to 00-asserting/2-isolate/1-variables/exercises/3-let-or-const.js diff --git a/0-asserting/2-isolate/1-variables/exercises/4-let-or-const.js b/00-asserting/2-isolate/1-variables/exercises/4-let-or-const.js similarity index 100% rename from 0-asserting/2-isolate/1-variables/exercises/4-let-or-const.js rename to 00-asserting/2-isolate/1-variables/exercises/4-let-or-const.js diff --git a/0-asserting/2-isolate/1-variables/exercises/5-let-or-const.js b/00-asserting/2-isolate/1-variables/exercises/5-let-or-const.js similarity index 100% rename from 0-asserting/2-isolate/1-variables/exercises/5-let-or-const.js rename to 00-asserting/2-isolate/1-variables/exercises/5-let-or-const.js diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/examples/1-strict-equality.js b/00-asserting/2-isolate/2-comparing-and-asserting/examples/1-strict-equality.js similarity index 100% rename from 0-asserting/2-isolate/2-comparing-and-asserting/examples/1-strict-equality.js rename to 00-asserting/2-isolate/2-comparing-and-asserting/examples/1-strict-equality.js diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/examples/2-assignment-vs-comparison.js b/00-asserting/2-isolate/2-comparing-and-asserting/examples/2-assignment-vs-comparison.js similarity index 100% rename from 0-asserting/2-isolate/2-comparing-and-asserting/examples/2-assignment-vs-comparison.js rename to 00-asserting/2-isolate/2-comparing-and-asserting/examples/2-assignment-vs-comparison.js diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/examples/3-console-assert.js b/00-asserting/2-isolate/2-comparing-and-asserting/examples/3-console-assert.js similarity index 100% rename from 0-asserting/2-isolate/2-comparing-and-asserting/examples/3-console-assert.js rename to 00-asserting/2-isolate/2-comparing-and-asserting/examples/3-console-assert.js diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/examples/4-assertion-testing.js b/00-asserting/2-isolate/2-comparing-and-asserting/examples/4-assertion-testing.js similarity index 100% rename from 0-asserting/2-isolate/2-comparing-and-asserting/examples/4-assertion-testing.js rename to 00-asserting/2-isolate/2-comparing-and-asserting/examples/4-assertion-testing.js diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/exercises/1-let.js b/00-asserting/2-isolate/2-comparing-and-asserting/exercises/1-let.js similarity index 100% rename from 0-asserting/2-isolate/2-comparing-and-asserting/exercises/1-let.js rename to 00-asserting/2-isolate/2-comparing-and-asserting/exercises/1-let.js diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/exercises/2-let.js b/00-asserting/2-isolate/2-comparing-and-asserting/exercises/2-let.js similarity index 100% rename from 0-asserting/2-isolate/2-comparing-and-asserting/exercises/2-let.js rename to 00-asserting/2-isolate/2-comparing-and-asserting/exercises/2-let.js diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/exercises/3-let-or-const.js b/00-asserting/2-isolate/2-comparing-and-asserting/exercises/3-let-or-const.js similarity index 100% rename from 0-asserting/2-isolate/2-comparing-and-asserting/exercises/3-let-or-const.js rename to 00-asserting/2-isolate/2-comparing-and-asserting/exercises/3-let-or-const.js diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/exercises/4-let-or-const.js b/00-asserting/2-isolate/2-comparing-and-asserting/exercises/4-let-or-const.js similarity index 100% rename from 0-asserting/2-isolate/2-comparing-and-asserting/exercises/4-let-or-const.js rename to 00-asserting/2-isolate/2-comparing-and-asserting/exercises/4-let-or-const.js diff --git a/0-asserting/2-isolate/2-comparing-and-asserting/exercises/5-let-or-const.js b/00-asserting/2-isolate/2-comparing-and-asserting/exercises/5-let-or-const.js similarity index 100% rename from 0-asserting/2-isolate/2-comparing-and-asserting/exercises/5-let-or-const.js rename to 00-asserting/2-isolate/2-comparing-and-asserting/exercises/5-let-or-const.js diff --git a/00-asserting/2-isolate/2-comparing-and-asserting/study.json b/00-asserting/2-isolate/2-comparing-and-asserting/study.json new file mode 100644 index 0000000..9fc712d --- /dev/null +++ b/00-asserting/2-isolate/2-comparing-and-asserting/study.json @@ -0,0 +1,9 @@ +{ + "study": { + "trace": { + "variablesDeclare": false, + "variablesAssign": false, + "variablesRead": false + } + } +} diff --git a/0-asserting/2-isolate/3-value-swaps/README.md b/00-asserting/2-isolate/3-value-swaps/README.md similarity index 100% rename from 0-asserting/2-isolate/3-value-swaps/README.md rename to 00-asserting/2-isolate/3-value-swaps/README.md diff --git a/0-asserting/2-isolate/3-value-swaps/example/double-swap.js b/00-asserting/2-isolate/3-value-swaps/example/double-swap.js similarity index 100% rename from 0-asserting/2-isolate/3-value-swaps/example/double-swap.js rename to 00-asserting/2-isolate/3-value-swaps/example/double-swap.js diff --git a/0-asserting/2-isolate/3-value-swaps/exercises/1-double-swap.js b/00-asserting/2-isolate/3-value-swaps/exercises/1-double-swap.js similarity index 100% rename from 0-asserting/2-isolate/3-value-swaps/exercises/1-double-swap.js rename to 00-asserting/2-isolate/3-value-swaps/exercises/1-double-swap.js diff --git a/0-asserting/2-isolate/3-value-swaps/exercises/2-triple-swap.js b/00-asserting/2-isolate/3-value-swaps/exercises/2-triple-swap.js similarity index 100% rename from 0-asserting/2-isolate/3-value-swaps/exercises/2-triple-swap.js rename to 00-asserting/2-isolate/3-value-swaps/exercises/2-triple-swap.js diff --git a/0-asserting/2-isolate/3-value-swaps/exercises/3-triple-swap.js b/00-asserting/2-isolate/3-value-swaps/exercises/3-triple-swap.js similarity index 100% rename from 0-asserting/2-isolate/3-value-swaps/exercises/3-triple-swap.js rename to 00-asserting/2-isolate/3-value-swaps/exercises/3-triple-swap.js diff --git a/0-asserting/2-isolate/3-value-swaps/exercises/4-quadruple-swap.js b/00-asserting/2-isolate/3-value-swaps/exercises/4-quadruple-swap.js similarity index 100% rename from 0-asserting/2-isolate/3-value-swaps/exercises/4-quadruple-swap.js rename to 00-asserting/2-isolate/3-value-swaps/exercises/4-quadruple-swap.js diff --git a/0-asserting/2-isolate/3-value-swaps/exercises/5-quadruple-swap.js b/00-asserting/2-isolate/3-value-swaps/exercises/5-quadruple-swap.js similarity index 100% rename from 0-asserting/2-isolate/3-value-swaps/exercises/5-quadruple-swap.js rename to 00-asserting/2-isolate/3-value-swaps/exercises/5-quadruple-swap.js diff --git a/0-asserting/2-isolate/3-value-swaps/exercises/6-let-and-const.js b/00-asserting/2-isolate/3-value-swaps/exercises/6-let-and-const.js similarity index 100% rename from 0-asserting/2-isolate/3-value-swaps/exercises/6-let-and-const.js rename to 00-asserting/2-isolate/3-value-swaps/exercises/6-let-and-const.js diff --git a/0-asserting/2-isolate/3-value-swaps/exercises/7-let-and-const.js b/00-asserting/2-isolate/3-value-swaps/exercises/7-let-and-const.js similarity index 100% rename from 0-asserting/2-isolate/3-value-swaps/exercises/7-let-and-const.js rename to 00-asserting/2-isolate/3-value-swaps/exercises/7-let-and-const.js diff --git a/0-asserting/2-isolate/README.md b/00-asserting/2-isolate/README.md similarity index 100% rename from 0-asserting/2-isolate/README.md rename to 00-asserting/2-isolate/README.md diff --git a/00-asserting/2-isolate/study.json b/00-asserting/2-isolate/study.json new file mode 100644 index 0000000..b666c63 --- /dev/null +++ b/00-asserting/2-isolate/study.json @@ -0,0 +1,6 @@ +{ + "study": { + "openIn": "jsTutorLive", + "ask": false + } +} diff --git a/00-asserting/README.md b/00-asserting/README.md new file mode 100644 index 0000000..9edab23 --- /dev/null +++ b/00-asserting/README.md @@ -0,0 +1,16 @@ +# Asserting + +## 0. Comments and Logs + +A short review of comments and logs, two JS language features designed to help +developers understand code. + +## 1. Predicting Execution + +A short review of stepping through and predicting program execution, plus some +guides for using different debugging tools. + +## 2. Isolate + +Practice predicting and verifying program execution with `console.assert` in +small programs that only use variables declared with `let` or `const`. diff --git a/1-primitives-and-operators/0-statements-vs-expressions/README.md b/01-primitives-and-operators/0-statements-vs-expressions/README.md similarity index 100% rename from 1-primitives-and-operators/0-statements-vs-expressions/README.md rename to 01-primitives-and-operators/0-statements-vs-expressions/README.md diff --git a/1-primitives-and-operators/1-primitive-types/examples/boolean-undefined-null.js b/01-primitives-and-operators/1-primitive-types/examples/boolean-undefined-null.js similarity index 100% rename from 1-primitives-and-operators/1-primitive-types/examples/boolean-undefined-null.js rename to 01-primitives-and-operators/1-primitive-types/examples/boolean-undefined-null.js diff --git a/1-primitives-and-operators/1-primitive-types/examples/number.js b/01-primitives-and-operators/1-primitive-types/examples/number.js similarity index 100% rename from 1-primitives-and-operators/1-primitive-types/examples/number.js rename to 01-primitives-and-operators/1-primitive-types/examples/number.js diff --git a/1-primitives-and-operators/1-primitive-types/examples/string.js b/01-primitives-and-operators/1-primitive-types/examples/string.js similarity index 100% rename from 1-primitives-and-operators/1-primitive-types/examples/string.js rename to 01-primitives-and-operators/1-primitive-types/examples/string.js diff --git a/1-primitives-and-operators/1-primitive-types/examples/typeof.js b/01-primitives-and-operators/1-primitive-types/examples/typeof.js similarity index 100% rename from 1-primitives-and-operators/1-primitive-types/examples/typeof.js rename to 01-primitives-and-operators/1-primitive-types/examples/typeof.js diff --git a/1-primitives-and-operators/1-primitive-types/exercises/fill-in-the-type.js b/01-primitives-and-operators/1-primitive-types/exercises/fill-in-the-type.js similarity index 100% rename from 1-primitives-and-operators/1-primitive-types/exercises/fill-in-the-type.js rename to 01-primitives-and-operators/1-primitive-types/exercises/fill-in-the-type.js diff --git a/01-primitives-and-operators/1-primitive-types/study.json b/01-primitives-and-operators/1-primitive-types/study.json new file mode 100644 index 0000000..9fc712d --- /dev/null +++ b/01-primitives-and-operators/1-primitive-types/study.json @@ -0,0 +1,9 @@ +{ + "study": { + "trace": { + "variablesDeclare": false, + "variablesAssign": false, + "variablesRead": false + } + } +} diff --git a/1-primitives-and-operators/2-explicit-coercion/README.md b/01-primitives-and-operators/2-explicit-coercion/README.md similarity index 100% rename from 1-primitives-and-operators/2-explicit-coercion/README.md rename to 01-primitives-and-operators/2-explicit-coercion/README.md diff --git a/1-primitives-and-operators/2-explicit-coercion/examples/1-string.js b/01-primitives-and-operators/2-explicit-coercion/examples/1-string.js similarity index 100% rename from 1-primitives-and-operators/2-explicit-coercion/examples/1-string.js rename to 01-primitives-and-operators/2-explicit-coercion/examples/1-string.js diff --git a/1-primitives-and-operators/2-explicit-coercion/examples/2-boolean.js b/01-primitives-and-operators/2-explicit-coercion/examples/2-boolean.js similarity index 100% rename from 1-primitives-and-operators/2-explicit-coercion/examples/2-boolean.js rename to 01-primitives-and-operators/2-explicit-coercion/examples/2-boolean.js diff --git a/1-primitives-and-operators/2-explicit-coercion/examples/3-number.js b/01-primitives-and-operators/2-explicit-coercion/examples/3-number.js similarity index 100% rename from 1-primitives-and-operators/2-explicit-coercion/examples/3-number.js rename to 01-primitives-and-operators/2-explicit-coercion/examples/3-number.js diff --git a/1-primitives-and-operators/2-explicit-coercion/examples/4-nan.js b/01-primitives-and-operators/2-explicit-coercion/examples/4-nan.js similarity index 100% rename from 1-primitives-and-operators/2-explicit-coercion/examples/4-nan.js rename to 01-primitives-and-operators/2-explicit-coercion/examples/4-nan.js diff --git a/1-primitives-and-operators/2-explicit-coercion/exercises/to-boolean.js b/01-primitives-and-operators/2-explicit-coercion/exercises/to-boolean.js similarity index 100% rename from 1-primitives-and-operators/2-explicit-coercion/exercises/to-boolean.js rename to 01-primitives-and-operators/2-explicit-coercion/exercises/to-boolean.js diff --git a/1-primitives-and-operators/2-explicit-coercion/exercises/to-number.js b/01-primitives-and-operators/2-explicit-coercion/exercises/to-number.js similarity index 100% rename from 1-primitives-and-operators/2-explicit-coercion/exercises/to-number.js rename to 01-primitives-and-operators/2-explicit-coercion/exercises/to-number.js diff --git a/1-primitives-and-operators/2-explicit-coercion/exercises/to-string.js b/01-primitives-and-operators/2-explicit-coercion/exercises/to-string.js similarity index 100% rename from 1-primitives-and-operators/2-explicit-coercion/exercises/to-string.js rename to 01-primitives-and-operators/2-explicit-coercion/exercises/to-string.js diff --git a/01-primitives-and-operators/2-explicit-coercion/study.json b/01-primitives-and-operators/2-explicit-coercion/study.json new file mode 100644 index 0000000..1aeef35 --- /dev/null +++ b/01-primitives-and-operators/2-explicit-coercion/study.json @@ -0,0 +1,11 @@ +{ + "study": { + "trace": { + "console": false, + "operators": false, + "variablesDeclare": false, + "variablesAssign": false, + "variablesRead": false + } + } +} diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/README.md b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/README.md similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/README.md rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/README.md diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/0-truthiness.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/0-truthiness.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/0-truthiness.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/0-truthiness.js diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/1-or.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/1-or.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/1-or.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/1-or.js diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/2-and.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/2-and.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/2-and.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/2-and.js diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/3-ternary.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/3-ternary.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/3-ternary.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/3-ternary.js diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/4-not.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/4-not.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/4-not.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/4-not.js diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/5-short-circuiting.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/5-short-circuiting.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/5-short-circuiting.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/examples/5-short-circuiting.js diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/and.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/and.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/and.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/and.js diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/not.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/not.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/not.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/not.js diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/or.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/or.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/or.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/or.js diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/ternary.js b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/ternary.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/ternary.js rename to 01-primitives-and-operators/3-common-operators/1-truthiness-operators/exercises/ternary.js diff --git a/01-primitives-and-operators/3-common-operators/1-truthiness-operators/study.json b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/study.json new file mode 100644 index 0000000..9fc712d --- /dev/null +++ b/01-primitives-and-operators/3-common-operators/1-truthiness-operators/study.json @@ -0,0 +1,9 @@ +{ + "study": { + "trace": { + "variablesDeclare": false, + "variablesAssign": false, + "variablesRead": false + } + } +} diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/README.md b/01-primitives-and-operators/3-common-operators/2-comparisons/README.md similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/README.md rename to 01-primitives-and-operators/3-common-operators/2-comparisons/README.md diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/examples/1-comparing-numbers.js b/01-primitives-and-operators/3-common-operators/2-comparisons/examples/1-comparing-numbers.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/examples/1-comparing-numbers.js rename to 01-primitives-and-operators/3-common-operators/2-comparisons/examples/1-comparing-numbers.js diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/examples/2-comparing-booleans.js b/01-primitives-and-operators/3-common-operators/2-comparisons/examples/2-comparing-booleans.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/examples/2-comparing-booleans.js rename to 01-primitives-and-operators/3-common-operators/2-comparisons/examples/2-comparing-booleans.js diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/examples/3-a-unicode.js b/01-primitives-and-operators/3-common-operators/2-comparisons/examples/3-a-unicode.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/examples/3-a-unicode.js rename to 01-primitives-and-operators/3-common-operators/2-comparisons/examples/3-a-unicode.js diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/examples/3-b-comparing-strings.js b/01-primitives-and-operators/3-common-operators/2-comparisons/examples/3-b-comparing-strings.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/examples/3-b-comparing-strings.js rename to 01-primitives-and-operators/3-common-operators/2-comparisons/examples/3-b-comparing-strings.js diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/examples/4-nan-null-undefined.js b/01-primitives-and-operators/3-common-operators/2-comparisons/examples/4-nan-null-undefined.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/examples/4-nan-null-undefined.js rename to 01-primitives-and-operators/3-common-operators/2-comparisons/examples/4-nan-null-undefined.js diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/exercises/greater-than-or-equal-to.js b/01-primitives-and-operators/3-common-operators/2-comparisons/exercises/greater-than-or-equal-to.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/exercises/greater-than-or-equal-to.js rename to 01-primitives-and-operators/3-common-operators/2-comparisons/exercises/greater-than-or-equal-to.js diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/exercises/greater-than.js b/01-primitives-and-operators/3-common-operators/2-comparisons/exercises/greater-than.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/exercises/greater-than.js rename to 01-primitives-and-operators/3-common-operators/2-comparisons/exercises/greater-than.js diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/exercises/less-than-or-equal-to.js b/01-primitives-and-operators/3-common-operators/2-comparisons/exercises/less-than-or-equal-to.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/exercises/less-than-or-equal-to.js rename to 01-primitives-and-operators/3-common-operators/2-comparisons/exercises/less-than-or-equal-to.js diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/exercises/less-than.js b/01-primitives-and-operators/3-common-operators/2-comparisons/exercises/less-than.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/2-comparisons/exercises/less-than.js rename to 01-primitives-and-operators/3-common-operators/2-comparisons/exercises/less-than.js diff --git a/01-primitives-and-operators/3-common-operators/2-comparisons/study.json b/01-primitives-and-operators/3-common-operators/2-comparisons/study.json new file mode 100644 index 0000000..9fc712d --- /dev/null +++ b/01-primitives-and-operators/3-common-operators/2-comparisons/study.json @@ -0,0 +1,9 @@ +{ + "study": { + "trace": { + "variablesDeclare": false, + "variablesAssign": false, + "variablesRead": false + } + } +} diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/README.md b/01-primitives-and-operators/3-common-operators/3-arithmetic/README.md similarity index 100% rename from 1-primitives-and-operators/3-common-operators/3-arithmetic/README.md rename to 01-primitives-and-operators/3-common-operators/3-arithmetic/README.md diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/examples/1-plus.js b/01-primitives-and-operators/3-common-operators/3-arithmetic/examples/1-plus.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/3-arithmetic/examples/1-plus.js rename to 01-primitives-and-operators/3-common-operators/3-arithmetic/examples/1-plus.js diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/examples/2-all-the-rest.js b/01-primitives-and-operators/3-common-operators/3-arithmetic/examples/2-all-the-rest.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/3-arithmetic/examples/2-all-the-rest.js rename to 01-primitives-and-operators/3-common-operators/3-arithmetic/examples/2-all-the-rest.js diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/examples/3-edge-cases.js b/01-primitives-and-operators/3-common-operators/3-arithmetic/examples/3-edge-cases.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/3-arithmetic/examples/3-edge-cases.js rename to 01-primitives-and-operators/3-common-operators/3-arithmetic/examples/3-edge-cases.js diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/division.js b/01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/division.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/division.js rename to 01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/division.js diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/multiplication.js b/01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/multiplication.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/multiplication.js rename to 01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/multiplication.js diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/plus.js b/01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/plus.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/plus.js rename to 01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/plus.js diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/remainder.js b/01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/remainder.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/remainder.js rename to 01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/remainder.js diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/subtraction.js b/01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/subtraction.js similarity index 100% rename from 1-primitives-and-operators/3-common-operators/3-arithmetic/exercises/subtraction.js rename to 01-primitives-and-operators/3-common-operators/3-arithmetic/exercises/subtraction.js diff --git a/01-primitives-and-operators/3-common-operators/3-arithmetic/study.json b/01-primitives-and-operators/3-common-operators/3-arithmetic/study.json new file mode 100644 index 0000000..9fc712d --- /dev/null +++ b/01-primitives-and-operators/3-common-operators/3-arithmetic/study.json @@ -0,0 +1,9 @@ +{ + "study": { + "trace": { + "variablesDeclare": false, + "variablesAssign": false, + "variablesRead": false + } + } +} diff --git a/1-primitives-and-operators/3-common-operators/README.md b/01-primitives-and-operators/3-common-operators/README.md similarity index 100% rename from 1-primitives-and-operators/3-common-operators/README.md rename to 01-primitives-and-operators/3-common-operators/README.md diff --git a/01-primitives-and-operators/3-common-operators/study.json b/01-primitives-and-operators/3-common-operators/study.json new file mode 100644 index 0000000..b666c63 --- /dev/null +++ b/01-primitives-and-operators/3-common-operators/study.json @@ -0,0 +1,6 @@ +{ + "study": { + "openIn": "jsTutorLive", + "ask": false + } +} diff --git a/1-primitives-and-operators/4-operator-precedence/README.md b/01-primitives-and-operators/4-operator-precedence/README.md similarity index 100% rename from 1-primitives-and-operators/4-operator-precedence/README.md rename to 01-primitives-and-operators/4-operator-precedence/README.md diff --git a/1-primitives-and-operators/4-operator-precedence/examples/parenthesis.js b/01-primitives-and-operators/4-operator-precedence/examples/parenthesis.js similarity index 100% rename from 1-primitives-and-operators/4-operator-precedence/examples/parenthesis.js rename to 01-primitives-and-operators/4-operator-precedence/examples/parenthesis.js diff --git a/1-primitives-and-operators/4-operator-precedence/exercises/1-math.js b/01-primitives-and-operators/4-operator-precedence/exercises/1-math.js similarity index 100% rename from 1-primitives-and-operators/4-operator-precedence/exercises/1-math.js rename to 01-primitives-and-operators/4-operator-precedence/exercises/1-math.js diff --git a/1-primitives-and-operators/4-operator-precedence/exercises/2-and-or.js b/01-primitives-and-operators/4-operator-precedence/exercises/2-and-or.js similarity index 100% rename from 1-primitives-and-operators/4-operator-precedence/exercises/2-and-or.js rename to 01-primitives-and-operators/4-operator-precedence/exercises/2-and-or.js diff --git a/1-primitives-and-operators/4-operator-precedence/exercises/3-strings.js b/01-primitives-and-operators/4-operator-precedence/exercises/3-strings.js similarity index 100% rename from 1-primitives-and-operators/4-operator-precedence/exercises/3-strings.js rename to 01-primitives-and-operators/4-operator-precedence/exercises/3-strings.js diff --git a/1-primitives-and-operators/4-operator-precedence/exercises/4-mixed.js b/01-primitives-and-operators/4-operator-precedence/exercises/4-mixed.js similarity index 100% rename from 1-primitives-and-operators/4-operator-precedence/exercises/4-mixed.js rename to 01-primitives-and-operators/4-operator-precedence/exercises/4-mixed.js diff --git a/01-primitives-and-operators/4-operator-precedence/study.json b/01-primitives-and-operators/4-operator-precedence/study.json new file mode 100644 index 0000000..8043752 --- /dev/null +++ b/01-primitives-and-operators/4-operator-precedence/study.json @@ -0,0 +1,8 @@ +{ + "study": { + "table": "operators", + "ask": false, + "variables": false, + "flowchart": false + } +} diff --git a/1-primitives-and-operators/5-increment-decrement/README.md b/01-primitives-and-operators/5-increment-decrement/README.md similarity index 100% rename from 1-primitives-and-operators/5-increment-decrement/README.md rename to 01-primitives-and-operators/5-increment-decrement/README.md diff --git a/1-primitives-and-operators/5-increment-decrement/examples/incrementing-const.js b/01-primitives-and-operators/5-increment-decrement/examples/incrementing-const.js similarity index 100% rename from 1-primitives-and-operators/5-increment-decrement/examples/incrementing-const.js rename to 01-primitives-and-operators/5-increment-decrement/examples/incrementing-const.js diff --git a/1-primitives-and-operators/5-increment-decrement/examples/postfix-decrement.js b/01-primitives-and-operators/5-increment-decrement/examples/postfix-decrement.js similarity index 100% rename from 1-primitives-and-operators/5-increment-decrement/examples/postfix-decrement.js rename to 01-primitives-and-operators/5-increment-decrement/examples/postfix-decrement.js diff --git a/1-primitives-and-operators/5-increment-decrement/examples/postfix-increment.js b/01-primitives-and-operators/5-increment-decrement/examples/postfix-increment.js similarity index 100% rename from 1-primitives-and-operators/5-increment-decrement/examples/postfix-increment.js rename to 01-primitives-and-operators/5-increment-decrement/examples/postfix-increment.js diff --git a/1-primitives-and-operators/5-increment-decrement/examples/prefix-decrement.js b/01-primitives-and-operators/5-increment-decrement/examples/prefix-decrement.js similarity index 100% rename from 1-primitives-and-operators/5-increment-decrement/examples/prefix-decrement.js rename to 01-primitives-and-operators/5-increment-decrement/examples/prefix-decrement.js diff --git a/1-primitives-and-operators/5-increment-decrement/examples/prefix-increment.js b/01-primitives-and-operators/5-increment-decrement/examples/prefix-increment.js similarity index 100% rename from 1-primitives-and-operators/5-increment-decrement/examples/prefix-increment.js rename to 01-primitives-and-operators/5-increment-decrement/examples/prefix-increment.js diff --git a/1-primitives-and-operators/5-increment-decrement/exercises/1.js b/01-primitives-and-operators/5-increment-decrement/exercises/1.js similarity index 100% rename from 1-primitives-and-operators/5-increment-decrement/exercises/1.js rename to 01-primitives-and-operators/5-increment-decrement/exercises/1.js diff --git a/1-primitives-and-operators/5-increment-decrement/exercises/2.js b/01-primitives-and-operators/5-increment-decrement/exercises/2.js similarity index 100% rename from 1-primitives-and-operators/5-increment-decrement/exercises/2.js rename to 01-primitives-and-operators/5-increment-decrement/exercises/2.js diff --git a/1-primitives-and-operators/5-increment-decrement/exercises/3.js b/01-primitives-and-operators/5-increment-decrement/exercises/3.js similarity index 100% rename from 1-primitives-and-operators/5-increment-decrement/exercises/3.js rename to 01-primitives-and-operators/5-increment-decrement/exercises/3.js diff --git a/01-primitives-and-operators/5-increment-decrement/study.json b/01-primitives-and-operators/5-increment-decrement/study.json new file mode 100644 index 0000000..4a68068 --- /dev/null +++ b/01-primitives-and-operators/5-increment-decrement/study.json @@ -0,0 +1,5 @@ +{ + "study": { + "trace": false + } +} diff --git a/1-primitives-and-operators/6-teplate-literals/README.md b/01-primitives-and-operators/6-teplate-literals/README.md similarity index 100% rename from 1-primitives-and-operators/6-teplate-literals/README.md rename to 01-primitives-and-operators/6-teplate-literals/README.md diff --git a/1-primitives-and-operators/6-teplate-literals/1-back-ticks.js b/01-primitives-and-operators/6-teplate-literals/examples/1-back-ticks.js similarity index 100% rename from 1-primitives-and-operators/6-teplate-literals/1-back-ticks.js rename to 01-primitives-and-operators/6-teplate-literals/examples/1-back-ticks.js diff --git a/1-primitives-and-operators/6-teplate-literals/2-interpolation.js b/01-primitives-and-operators/6-teplate-literals/examples/2-interpolation.js similarity index 100% rename from 1-primitives-and-operators/6-teplate-literals/2-interpolation.js rename to 01-primitives-and-operators/6-teplate-literals/examples/2-interpolation.js diff --git a/1-primitives-and-operators/6-teplate-literals/3-refactoring.js b/01-primitives-and-operators/6-teplate-literals/examples/3-refactoring.js similarity index 100% rename from 1-primitives-and-operators/6-teplate-literals/3-refactoring.js rename to 01-primitives-and-operators/6-teplate-literals/examples/3-refactoring.js diff --git a/01-primitives-and-operators/README.md b/01-primitives-and-operators/README.md new file mode 100644 index 0000000..5c36e12 --- /dev/null +++ b/01-primitives-and-operators/README.md @@ -0,0 +1,77 @@ +# Primitives and Operators + +## 0. Statements vs. Expressions + +A short theory lesson about the main difference between _statements_ and +_expressions_, plus a simple strategy for checking if something is a statement +or an expression. + +## 1. Primitive Types + +Introces the main primitive types in JS using examples - _booleans_, _numbers_, +_strings_, _null_, _undefined_. You will also learn about the `typeof` operator, +and practice predicting the operator's behavior with different values. + +## 2. Explicit Coercion + +Learn the rules JavaScript follows when converting primitive values to a +different type, practice these rules by predicting the output of different +conversions. + +This is one of the most important exercises in the module! _If you do not +understand how explicit type coercion works in JavaScript **implicit coercion** +can feel like a black box. Once you understand how explicit coercion works, it +may still seem illogical but it won't be confusing._ + +## 3. Common Operators + +Explore some of the most common operators in JavaScript by example, and practice +predicting their behavior with assertion tests. You should be comfortable with +**Explicit Coercion** before starting this chapter, otherwise _implicit +coercion_ can feel like a black box! + +Operators are grouped into three categories: + +1. **Truthiness Operators**: These operators' behavior is determined by the + _truthiness_ of their inputs. Most operators produce a new value based on + their inputs, however some of these operators are different because they + _choose_ one of the inputs instead of producing a new value. +2. **Comparisons**: Learn how JavaScript compares different primitive values + using examples and assertion tests. Comparisons will always evaluate to + `true` or `false`! +3. **Arithmetic** Learn about the basic math operators in JavaScript, as well as + their rules for _implicit coercion_. + +## 4. Operator Precedence + +Learn how to read, trace and predict JavaScript expressions with more than one +operator. You will learn the rules of _operator precedence_ which determine +which operator will be evaluated first, second, ... + +You will also learn to think about _substitution_ when reading and tracing +expressions. Substitution is when you replace an operator with it's result, +making it easier to think about complex expressions one step at a time. + +## 5. Increment, Decrement + +So far all the operators you learned about work with primitive types and do not +modify variables. They may _read_ values from a variable, but they did not +_modify_ the value stored in memory. + +**In-place operators** like _increment_ and _decrement_ are completely +different! They can only be used on variables, not a primitive literal like +`"hello"` or `true`. They also modify the value stored in the variable and give +a result! This makes tracing, predicting and debugging these operators more +challenging. + +Increment and Decrement are useful operators, but you need to be careful where +you use them in your programs to keep your code easy to read. Hopefully these +intentionally confusing exercises will help you understand best practices! + +## 6. Template Literals + +Finally, pull everything together as you learn how _template literals_ work. +This is also a great review of _statements vs. expressions_. + +There are no exercises (yet) in this section, but you will have plenty of chance +to practice in the coming chapters. diff --git a/01-primitives-and-operators/study.json b/01-primitives-and-operators/study.json new file mode 100644 index 0000000..d8e8975 --- /dev/null +++ b/01-primitives-and-operators/study.json @@ -0,0 +1,5 @@ +{ + "study": { + "eslint": false + } +} diff --git a/02-just-enough-dom/README.md b/02-just-enough-dom/README.md new file mode 100644 index 0000000..62721c2 --- /dev/null +++ b/02-just-enough-dom/README.md @@ -0,0 +1,214 @@ +# Just Enough DOM + +In this module you will begin exploring the Document Object Model (DOM). Because +your main focus is still the inner workings of JavaScript you will only learn +enough DOM to write simple programs that store _state_, read user data, process +it, and display the result as a string. + +Below is a quick introduction to how you will structure your programs in this +module, and the few DOM features you will need to write them + +- [Program Structure](#program-structure) + - [State](#state) + - [Constants](#constants) +- [DOM Features](#dom-features) + - [Saving DOM elements to Variables](#saving-dom-elements-to-variables) + - [Defining User Interactions](#defining-user-interactions) + - [Reading User Input](#reading-user-input) + - [Displaying Program Results](#displaying-program-results) +- [Reverse-Engineering](#reverse-engineering) + +--- + +## Program Structure + +Each of the programs in this module will follow a structure similar to this. Not +every program will have every section: + +```js +// imports, if any (more on this later in "Using Functions") + +/* + describe the program's behavior +*/ + +// --- declare constants --- + +// --- declare state --- + +// --- save important DOM elements to variables --- + +// --- add event listeners + handlers --- + +// read user input +// process user input +// display result + +// --- initialize user interface --- +``` + +### State + +An important concept in this module's programs is _state_: the data stored in +program memory that users can interact with and change. Not every program will +have state! + +For now, just remember the basic idea of _state_ as data stored in program +memory that changes based on user actions. You'll get plenty of practice with +the concept through the examples and exercises. + +### Constants + +_Constants_ are data stored in program memory that are never changed. + +As you explore the examples and exercises you will learn about different ways +constants can be used in a program. + +--- + +## DOM Features + +Below are all the DOM you will need to write programs in this module. + +Of course you can always search online to learn more about the DOM, but don't +get too side-tracked! The goal of this module is to deeply understand program +memory, how to work with program state, and how to use pure functions for +program logic. + +Going too far down the road of DOM manipulation will distract from these +objectives. You'll always have time to study the DOM later, and will even have +an easier time learning it after mastering this module's objectives. + +### Saving DOM elements to Variables + +Using `document.getElementById('id')` you can save a DOM element to a variable +for later use. This is practical for reading user input, displaying program +output, and defining user interactions with event listeners. + +```html +
` element by setting +its `.innerText` property. This is the simplest way to display structured +information to a user with the DOM, and more than enough for this module. + +```html ++ ++ + +``` + +--- + +## Reverse-Engineering + +Most DOM exercises in this module will be based on **reverse-engineering**. +Instead of an open-ended project description, you will be given a working piece +of software to recreate. You will be able to run the code, but not read it. +Well, you _can_ read it but where's the fun in that?! Anyway there's always more +than one way to solve a problem so even if you do study the solution, you can +still find another way to solve it. + +Reverse-engineering exercises will have the solution in a file named +`script.re.js`. `.re` stands for "reverse-engineer and it's just there for +humans to know the file's purpose: + +```markdown +/exercise-name + /index.html + /script.js + /script.re.js + /styles.css +``` diff --git a/02-just-enough-dom/examples/counter/index.html b/02-just-enough-dom/examples/counter/index.html new file mode 100644 index 0000000..6eb3bd9 --- /dev/null +++ b/02-just-enough-dom/examples/counter/index.html @@ -0,0 +1,20 @@ + + + + +
+ + +
+ + +Counter + + + + + ++ + + + ++ + + + diff --git a/02-just-enough-dom/examples/counter/script.js b/02-just-enough-dom/examples/counter/script.js new file mode 100644 index 0000000..2333827 --- /dev/null +++ b/02-just-enough-dom/examples/counter/script.js @@ -0,0 +1,45 @@ +'sue strict'; + +/* Counter + A program that allows a user to add or subtract 1 from a number. +*/ + +// debugger; // pause when the program is initializing + +// --- declare state variables --- + +let count = 0; + +// --- save important dom elements to variables --- + +const upButtonEl = document.getElementById('up'); +const downButtonEl = document.getElementById('down'); + +const displayCountEl = document.getElementById('display-count'); + +// --- add event listeners + handlers --- + +downButtonEl.addEventListener('click', () => { + console.log('subtracting 1'); + // debugger; // pause when subtracting 1 + + count -= 1; + displayCountEl.innerText = count; + + console.log(count); +}); + +upButtonEl.addEventListener('click', () => { + console.log('adding 1'); + // debugger; // pause when adding 1 + count += 1; + displayCountEl.innerText = count; + + console.log(count); +}); + +// --- initialize UI --- + +displayCountEl.innerText = count; + +console.log(count); diff --git a/2-control-flow/3-dom-ui/multiplication/styles.css b/02-just-enough-dom/examples/counter/styles.css similarity index 100% rename from 2-control-flow/3-dom-ui/multiplication/styles.css rename to 02-just-enough-dom/examples/counter/styles.css diff --git a/02-just-enough-dom/examples/dog-or-cat/index.html b/02-just-enough-dom/examples/dog-or-cat/index.html new file mode 100644 index 0000000..5b6b05b --- /dev/null +++ b/02-just-enough-dom/examples/dog-or-cat/index.html @@ -0,0 +1,22 @@ + + + + +Dog or Cat + + + + + ++ + + ++ + + + diff --git a/02-just-enough-dom/examples/dog-or-cat/script.js b/02-just-enough-dom/examples/dog-or-cat/script.js new file mode 100644 index 0000000..f1c086d --- /dev/null +++ b/02-just-enough-dom/examples/dog-or-cat/script.js @@ -0,0 +1,43 @@ +'sue strict'; + +/* Counter + A program that allows a user to add or subtract 1 from a number. +*/ + +// debugger; // pause when the program is initializing + +// --- declare constants --- + +const DOG = ` / \\__ +( @\\___ +/ O +/ (_____/ +/_____/ U`; + +const CAT = ` /\\_/\\ +( o o ) +==_Y_== + \`-'`; + +// --- save important dom elements to variables --- + +const dogOrCatInput = document.getElementById('dog-or-cat'); + +const kennelEl = document.getElementById('kennel'); + +// --- add event listeners + handlers --- + +dogOrCatInput.addEventListener('change', () => { + debugger; + const displayDog = dogOrCatInput.checked; + + if (displayDog) { + kennelEl.innerText = DOG; + } else { + kennelEl.innerText = CAT; + } +}); + +// --- initialize UI --- + +kennelEl.innerText = CAT; diff --git a/2-control-flow/3-dom-ui/repeat-characters/styles.css b/02-just-enough-dom/examples/dog-or-cat/styles.css similarity index 100% rename from 2-control-flow/3-dom-ui/repeat-characters/styles.css rename to 02-just-enough-dom/examples/dog-or-cat/styles.css diff --git a/02-just-enough-dom/examples/echo/index.html b/02-just-enough-dom/examples/echo/index.html new file mode 100644 index 0000000..2bfa493 --- /dev/null +++ b/02-just-enough-dom/examples/echo/index.html @@ -0,0 +1,23 @@ + + + + +
+ + +Echo + + + + + ++ ++ + + + diff --git a/02-just-enough-dom/examples/echo/script.js b/02-just-enough-dom/examples/echo/script.js new file mode 100644 index 0000000..9d32dd4 --- /dev/null +++ b/02-just-enough-dom/examples/echo/script.js @@ -0,0 +1,22 @@ +'use strict'; + +/* Echo + A program that echo's a user's input to the DOM and the console +*/ + +// --- save important DON elements to variables --- + +const userTextEl = document.getElementById('user-text'); +const echoButtonEl = document.getElementById('echo-button'); + +const displayZoneEl = document.getElementById('display-zone'); + +// --- add event listeners + handlers --- + +echoButtonEl.addEventListener('click', () => { + const userInput = userTextEl.value; + + console.log(userInput); + + displayZoneEl.innerText = userTextEl.value; +}); diff --git a/2-control-flow/3-dom-ui/repeat-string/styles.css b/02-just-enough-dom/examples/echo/styles.css similarity index 100% rename from 2-control-flow/3-dom-ui/repeat-string/styles.css rename to 02-just-enough-dom/examples/echo/styles.css diff --git a/02-just-enough-dom/examples/types/index.html b/02-just-enough-dom/examples/types/index.html new file mode 100644 index 0000000..af4c97b --- /dev/null +++ b/02-just-enough-dom/examples/types/index.html @@ -0,0 +1,35 @@ + + + + +
+ + +
+ + +Types + + + + + ++ + ++ + + + diff --git a/02-just-enough-dom/examples/types/script.js b/02-just-enough-dom/examples/types/script.js new file mode 100644 index 0000000..7cf95a4 --- /dev/null +++ b/02-just-enough-dom/examples/types/script.js @@ -0,0 +1,56 @@ +'use strict'; + +/* Types + + A demonstration of how to read different types from the DOM + + Except for checkbox.checked, all input types return a string! + +*/ + +// --- save important DON elements to variables --- + +const typesFormEl = document.getElementById('types-form'); + +const stringInputEl = document.getElementById('string-input'); +const booleanInputEl = document.getElementById('boolean-input'); +const numberInputEl = document.getElementById('number-input'); + +const displayZoneEl = document.getElementById('display-zone'); + +// getting an ID that does not exist will return null +// this is a mistake! you don't do this on purpose +const elementDoesNotExist = document.getElementById('does-not-exist'); +console.assert(elementDoesNotExist === null); + +// --- add event listeners + handlers --- + +typesFormEl.addEventListener('input', () => { + debugger; + + // -- reading string values in a program + const userString = stringInputEl.value; + console.assert(typeof userString === 'string', 'Test 1'); + + // -- reading boolean values in a program + const userBoolean = booleanInputEl.checked; + console.assert(typeof userBoolean === 'boolean', 'Test 2'); + // checkbox.value is not a boolean! + console.log('checkbox.value:', booleanInputEl.value); + + // -- reading number values in a program + const userNumberString = numberInputEl.value; + console.assert(typeof userNumberString === 'string', 'Test 3'); + // don't forget to cast to number! + const userNumber = Number(userNumberString); + console.assert(typeof userNumber === 'number', 'Test 4'); + + // -- accessing a non-existent property on an element + const propertyDoesNotExist = typesFormEl.doesNotExist; + console.assert(propertyDoesNotExist === undefined, 'Test 5'); + + displayZoneEl.innerText = `form values: + ${typeof userString}: ${userString} + ${typeof userBoolean}: ${userBoolean} + ${typeof userNumberString}: ${userNumber}`; +}); diff --git a/2-control-flow/3-dom-ui/reverse-string/styles.css b/02-just-enough-dom/examples/types/styles.css similarity index 100% rename from 2-control-flow/3-dom-ui/reverse-string/styles.css rename to 02-just-enough-dom/examples/types/styles.css diff --git a/02-just-enough-dom/exercises/calculator/index.html b/02-just-enough-dom/exercises/calculator/index.html new file mode 100644 index 0000000..7558a6a --- /dev/null +++ b/02-just-enough-dom/exercises/calculator/index.html @@ -0,0 +1,35 @@ + + + + +
+ + +Calculator + + + + + ++ ++ + + + + diff --git a/02-just-enough-dom/exercises/calculator/script.js b/02-just-enough-dom/exercises/calculator/script.js new file mode 100644 index 0000000..7a40f43 --- /dev/null +++ b/02-just-enough-dom/exercises/calculator/script.js @@ -0,0 +1,52 @@ +'use strict'; + +/* Calculator + + Do math with two numbers. + +*/ + +// --- save important DON elements to variables --- + +const leftNumberEl = _; +const rightNumberEl = _; + +const addButton = _; +const subtractButton = _; +const multiplyButton = _; +const divideButton = _; + +const displayEl = _; + +// --- add event listeners + handlers --- + +addButton.addEventListener('click', () => { + const leftNum = Number(_._); + const rightNum = _(_._); + + const sum = leftNum + rightNum; + + _._ = `${leftNum} + ${rightNum} = ${sum}`; +}); + +_.addEventListener('click', () => { + const leftNum = _(_); + const rightNum = _(_); + + const difference = _; + + _._ = `${_} - ${_} = ${_}`; +}); + +multiplyButton._('_', () => { + const leftNum = _; + const rightNum = _; + + const product = _; + + _ = _; +}); + +_._(_, () => { + /* write this whole thing */ +}); diff --git a/02-just-enough-dom/exercises/calculator/script.re.js b/02-just-enough-dom/exercises/calculator/script.re.js new file mode 100644 index 0000000..001b642 --- /dev/null +++ b/02-just-enough-dom/exercises/calculator/script.re.js @@ -0,0 +1,48 @@ +document + .getElementById('add') + .addEventListener( + 'click', + () => + (document.getElementById('display-expected').innerText = `${Number( + document.getElementById('left').value, + )} + ${Number(document.getElementById('right').value)} = ${ + Number(document.getElementById('left').value) + + Number(document.getElementById('right').value) + }`), + ), + document + .getElementById('subtract') + .addEventListener( + 'click', + () => + (document.getElementById('display-expected').innerText = `${Number( + document.getElementById('left').value, + )} - ${Number(document.getElementById('right').value)} = ${ + Number(document.getElementById('left').value) - + Number(document.getElementById('right').value) + }`), + ), + document + .getElementById('multiply') + .addEventListener( + 'click', + () => + (document.getElementById('display-expected').innerText = `${Number( + document.getElementById('left').value, + )} * ${Number(document.getElementById('right').value)} = ${ + Number(document.getElementById('left').value) * + Number(document.getElementById('right').value) + }`), + ), + document + .getElementById('divide') + .addEventListener( + 'click', + () => + (document.getElementById('display-expected').innerText = `${Number( + document.getElementById('left').value, + )} / ${Number(document.getElementById('right').value)} = ${ + Number(document.getElementById('left').value) / + Number(document.getElementById('right').value) + }`), + ); diff --git a/2-control-flow/3-dom-ui/skip/styles.css b/02-just-enough-dom/exercises/calculator/styles.css similarity index 100% rename from 2-control-flow/3-dom-ui/skip/styles.css rename to 02-just-enough-dom/exercises/calculator/styles.css diff --git a/02-just-enough-dom/exercises/mad-lib/index.html b/02-just-enough-dom/exercises/mad-lib/index.html new file mode 100644 index 0000000..08251ad --- /dev/null +++ b/02-just-enough-dom/exercises/mad-lib/index.html @@ -0,0 +1,38 @@ + + + + +
+ +
+ + + + + +
+ +your output:
+ + +
+ +expected output:
+ +Mad Lib + + + + + ++ + ++ + + + + diff --git a/02-just-enough-dom/exercises/mad-lib/script.js b/02-just-enough-dom/exercises/mad-lib/script.js new file mode 100644 index 0000000..b7991f4 --- /dev/null +++ b/02-just-enough-dom/exercises/mad-lib/script.js @@ -0,0 +1,48 @@ +'use strict'; + +/* Mad Lib + + This program creates a humorous sentence with the user's suggestions. + + The sentence is not displayed until all 3 inputs are filled. + +*/ + +// --- save important DON elements to variables --- + +const suggestionsForm = _._(_); +console.assert(suggestionsForm.id === 'suggestions', 'Test 1'); + +const nounInput = _._(_); +console.assert(nounInput.placeholder === 'plural noun', 'Test 2'); + +const verbInput = _._(_); +console.assert(verbInput.type === 'text', 'Test 3'); + +const adjectiveInput = _._(_); +console.assert(verbInput.nodeName === 'INPUT', 'Test 4'); + +const displayEl = _._(_); +console.assert(displayEl.innerText === '', 'Test 5'); + +// --- add event listeners + handlers --- + +_._('input', () => { + // --- read user input --- + + const noun = _._; + const verb = _._; + const adjective = _._; + + // --- decide whether to display the sentence --- + + const showSentence = noun !== '' && verb !== '' && adjective !== ''; + + // --- update the UI --- + + if (_) { + _._ = `When the sunset is ${adjective}, ${noun}s always ${verb}.`; + } else { + _._ = ''; + } +}); diff --git a/02-just-enough-dom/exercises/mad-lib/script.re.js b/02-just-enough-dom/exercises/mad-lib/script.re.js new file mode 100644 index 0000000..f615d87 --- /dev/null +++ b/02-just-enough-dom/exercises/mad-lib/script.re.js @@ -0,0 +1,15 @@ +document + .getElementById('suggestions') + .addEventListener('input', () => + document.getElementById('noun').value !== '' && + document.getElementById('verb').value !== '' && + document.getElementById('adjective').value !== '' + ? (document.getElementById( + 'display-expected', + ).innerText = `When the sunset is ${ + document.getElementById('adjective').value + }, ${document.getElementById('noun').value}s always ${ + document.getElementById('verb').value + }.`) + : (document.getElementById('display-expected').innerText = ''), + ); diff --git a/2-control-flow/3-dom-ui/upside-down-pyramid/styles.css b/02-just-enough-dom/exercises/mad-lib/styles.css similarity index 100% rename from 2-control-flow/3-dom-ui/upside-down-pyramid/styles.css rename to 02-just-enough-dom/exercises/mad-lib/styles.css diff --git a/2-control-flow/1-isolate/0-block-scope/README.md b/03-control-flow/1-isolate/0-block-scope/README.md similarity index 100% rename from 2-control-flow/1-isolate/0-block-scope/README.md rename to 03-control-flow/1-isolate/0-block-scope/README.md diff --git a/2-control-flow/1-isolate/0-block-scope/examples/1-declaring-and-reading.js b/03-control-flow/1-isolate/0-block-scope/examples/1-declaring-and-reading.js similarity index 100% rename from 2-control-flow/1-isolate/0-block-scope/examples/1-declaring-and-reading.js rename to 03-control-flow/1-isolate/0-block-scope/examples/1-declaring-and-reading.js diff --git a/2-control-flow/1-isolate/0-block-scope/examples/2-assigning.js b/03-control-flow/1-isolate/0-block-scope/examples/2-assigning.js similarity index 100% rename from 2-control-flow/1-isolate/0-block-scope/examples/2-assigning.js rename to 03-control-flow/1-isolate/0-block-scope/examples/2-assigning.js diff --git a/2-control-flow/1-isolate/0-block-scope/examples/3-temporal-dead-zone.js b/03-control-flow/1-isolate/0-block-scope/examples/3-temporal-dead-zone.js similarity index 100% rename from 2-control-flow/1-isolate/0-block-scope/examples/3-temporal-dead-zone.js rename to 03-control-flow/1-isolate/0-block-scope/examples/3-temporal-dead-zone.js diff --git a/2-control-flow/1-isolate/0-block-scope/exercises/1-missing-values.js b/03-control-flow/1-isolate/0-block-scope/exercises/1-missing-values.js similarity index 100% rename from 2-control-flow/1-isolate/0-block-scope/exercises/1-missing-values.js rename to 03-control-flow/1-isolate/0-block-scope/exercises/1-missing-values.js diff --git a/2-control-flow/1-isolate/0-block-scope/exercises/2-missing-values.js b/03-control-flow/1-isolate/0-block-scope/exercises/2-missing-values.js similarity index 100% rename from 2-control-flow/1-isolate/0-block-scope/exercises/2-missing-values.js rename to 03-control-flow/1-isolate/0-block-scope/exercises/2-missing-values.js diff --git a/2-control-flow/1-isolate/0-block-scope/exercises/3-missing-variables.js b/03-control-flow/1-isolate/0-block-scope/exercises/3-missing-variables.js similarity index 100% rename from 2-control-flow/1-isolate/0-block-scope/exercises/3-missing-variables.js rename to 03-control-flow/1-isolate/0-block-scope/exercises/3-missing-variables.js diff --git a/2-control-flow/1-isolate/0-block-scope/exercises/4-missing-variables.js b/03-control-flow/1-isolate/0-block-scope/exercises/4-missing-variables.js similarity index 100% rename from 2-control-flow/1-isolate/0-block-scope/exercises/4-missing-variables.js rename to 03-control-flow/1-isolate/0-block-scope/exercises/4-missing-variables.js diff --git a/2-control-flow/1-isolate/0-block-scope/exercises/5-missing-variables.js b/03-control-flow/1-isolate/0-block-scope/exercises/5-missing-variables.js similarity index 100% rename from 2-control-flow/1-isolate/0-block-scope/exercises/5-missing-variables.js rename to 03-control-flow/1-isolate/0-block-scope/exercises/5-missing-variables.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/examples/1-if.js b/03-control-flow/1-isolate/1-conditional-statements/examples/1-if.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/examples/1-if.js rename to 03-control-flow/1-isolate/1-conditional-statements/examples/1-if.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/examples/2-if-else.js b/03-control-flow/1-isolate/1-conditional-statements/examples/2-if-else.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/examples/2-if-else.js rename to 03-control-flow/1-isolate/1-conditional-statements/examples/2-if-else.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/examples/3-if-else-if.js b/03-control-flow/1-isolate/1-conditional-statements/examples/3-if-else-if.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/examples/3-if-else-if.js rename to 03-control-flow/1-isolate/1-conditional-statements/examples/3-if-else-if.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/examples/4-if-else-if-else.js b/03-control-flow/1-isolate/1-conditional-statements/examples/4-if-else-if-else.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/examples/4-if-else-if-else.js rename to 03-control-flow/1-isolate/1-conditional-statements/examples/4-if-else-if-else.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/examples/5-unreachable-paths.js b/03-control-flow/1-isolate/1-conditional-statements/examples/5-unreachable-paths.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/examples/5-unreachable-paths.js rename to 03-control-flow/1-isolate/1-conditional-statements/examples/5-unreachable-paths.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/1.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/1.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/1.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/1.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/2.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/2.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/2.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/2.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/3.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/3.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/3.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/3.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/4.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/4.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/4.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/1-assert-path/4.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/1.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/1.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/1.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/1.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/2.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/2.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/2.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/2.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/3.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/3.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/3.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/3.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/4.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/4.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/4.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/2-initial-values/4.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/1.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/1.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/1.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/1.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/2.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/2.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/2.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/2.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/3.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/3.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/3.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/3.js diff --git a/2-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/4.js b/03-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/4.js similarity index 100% rename from 2-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/4.js rename to 03-control-flow/1-isolate/1-conditional-statements/exercises/3-conditions/4.js diff --git a/03-control-flow/1-isolate/1-conditional-statements/study.json b/03-control-flow/1-isolate/1-conditional-statements/study.json new file mode 100644 index 0000000..395b357 --- /dev/null +++ b/03-control-flow/1-isolate/1-conditional-statements/study.json @@ -0,0 +1,5 @@ +{ + "study": { + "flowchart": true + } +} diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/README.md b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/README.md similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/README.md rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/README.md diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/and.js b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/and.js similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/and.js rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/and.js diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/or.js b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/or.js similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/or.js rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/or.js diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/ternary.js b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/ternary.js similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/ternary.js rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/examples/ternary.js diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/and-to-condition.js b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/and-to-condition.js similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/and-to-condition.js rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/and-to-condition.js diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-and.js b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-and.js similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-and.js rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-and.js diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-or.js b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-or.js similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-or.js rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-or.js diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-ternary.js b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-ternary.js similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-ternary.js rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/condition-to-ternary.js diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/or-to-condition.js b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/or-to-condition.js similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/or-to-condition.js rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/or-to-condition.js diff --git a/2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/ternary-to-condition.js b/03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/ternary-to-condition.js similarity index 100% rename from 2-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/ternary-to-condition.js rename to 03-control-flow/1-isolate/2-refactoring-truthiness-operators/exercises/ternary-to-condition.js diff --git a/2-control-flow/1-isolate/3-while-loops/examples/1-while.js b/03-control-flow/1-isolate/3-while-loops/examples/1-while.js similarity index 100% rename from 2-control-flow/1-isolate/3-while-loops/examples/1-while.js rename to 03-control-flow/1-isolate/3-while-loops/examples/1-while.js diff --git a/2-control-flow/1-isolate/3-while-loops/examples/2-while-infinite.js b/03-control-flow/1-isolate/3-while-loops/examples/2-while-infinite.js similarity index 100% rename from 2-control-flow/1-isolate/3-while-loops/examples/2-while-infinite.js rename to 03-control-flow/1-isolate/3-while-loops/examples/2-while-infinite.js diff --git a/2-control-flow/1-isolate/3-while-loops/exercises/1-one-dozen-eggs.js b/03-control-flow/1-isolate/3-while-loops/exercises/1-one-dozen-eggs.js similarity index 100% rename from 2-control-flow/1-isolate/3-while-loops/exercises/1-one-dozen-eggs.js rename to 03-control-flow/1-isolate/3-while-loops/exercises/1-one-dozen-eggs.js diff --git a/2-control-flow/1-isolate/3-while-loops/exercises/2-stepping-up.js b/03-control-flow/1-isolate/3-while-loops/exercises/2-stepping-up.js similarity index 100% rename from 2-control-flow/1-isolate/3-while-loops/exercises/2-stepping-up.js rename to 03-control-flow/1-isolate/3-while-loops/exercises/2-stepping-up.js diff --git a/2-control-flow/1-isolate/3-while-loops/exercises/3-stepping-down.js b/03-control-flow/1-isolate/3-while-loops/exercises/3-stepping-down.js similarity index 100% rename from 2-control-flow/1-isolate/3-while-loops/exercises/3-stepping-down.js rename to 03-control-flow/1-isolate/3-while-loops/exercises/3-stepping-down.js diff --git a/2-control-flow/1-isolate/3-while-loops/exercises/4-initial-value.js b/03-control-flow/1-isolate/3-while-loops/exercises/4-initial-value.js similarity index 100% rename from 2-control-flow/1-isolate/3-while-loops/exercises/4-initial-value.js rename to 03-control-flow/1-isolate/3-while-loops/exercises/4-initial-value.js diff --git a/2-control-flow/1-isolate/3-while-loops/exercises/5-boolean-flag-variable.js b/03-control-flow/1-isolate/3-while-loops/exercises/5-boolean-flag-variable.js similarity index 100% rename from 2-control-flow/1-isolate/3-while-loops/exercises/5-boolean-flag-variable.js rename to 03-control-flow/1-isolate/3-while-loops/exercises/5-boolean-flag-variable.js diff --git a/2-control-flow/1-isolate/4-break-continue/examples/break.js b/03-control-flow/1-isolate/4-break-continue/examples/break.js similarity index 100% rename from 2-control-flow/1-isolate/4-break-continue/examples/break.js rename to 03-control-flow/1-isolate/4-break-continue/examples/break.js diff --git a/2-control-flow/1-isolate/4-break-continue/examples/continue.js b/03-control-flow/1-isolate/4-break-continue/examples/continue.js similarity index 100% rename from 2-control-flow/1-isolate/4-break-continue/examples/continue.js rename to 03-control-flow/1-isolate/4-break-continue/examples/continue.js diff --git a/2-control-flow/1-isolate/4-break-continue/examples/together.js b/03-control-flow/1-isolate/4-break-continue/examples/together.js similarity index 100% rename from 2-control-flow/1-isolate/4-break-continue/examples/together.js rename to 03-control-flow/1-isolate/4-break-continue/examples/together.js diff --git a/2-control-flow/1-isolate/4-break-continue/exercises/every-other-letter-1.js b/03-control-flow/1-isolate/4-break-continue/exercises/every-other-letter-1.js similarity index 100% rename from 2-control-flow/1-isolate/4-break-continue/exercises/every-other-letter-1.js rename to 03-control-flow/1-isolate/4-break-continue/exercises/every-other-letter-1.js diff --git a/2-control-flow/1-isolate/4-break-continue/exercises/every-other-letter-2.js b/03-control-flow/1-isolate/4-break-continue/exercises/every-other-letter-2.js similarity index 100% rename from 2-control-flow/1-isolate/4-break-continue/exercises/every-other-letter-2.js rename to 03-control-flow/1-isolate/4-break-continue/exercises/every-other-letter-2.js diff --git a/2-control-flow/1-isolate/4-break-continue/exercises/find-letter-index.js b/03-control-flow/1-isolate/4-break-continue/exercises/find-letter-index.js similarity index 100% rename from 2-control-flow/1-isolate/4-break-continue/exercises/find-letter-index.js rename to 03-control-flow/1-isolate/4-break-continue/exercises/find-letter-index.js diff --git a/2-control-flow/1-isolate/5-for-of-strings/for-character-of.js b/03-control-flow/1-isolate/5-for-of-strings/for-character-of.js similarity index 100% rename from 2-control-flow/1-isolate/5-for-of-strings/for-character-of.js rename to 03-control-flow/1-isolate/5-for-of-strings/for-character-of.js diff --git a/2-control-flow/1-isolate/6-for-loops/README.md b/03-control-flow/1-isolate/6-for-loops/README.md similarity index 82% rename from 2-control-flow/1-isolate/6-for-loops/README.md rename to 03-control-flow/1-isolate/6-for-loops/README.md index bdbbe24..eba0e67 100644 --- a/2-control-flow/1-isolate/6-for-loops/README.md +++ b/03-control-flow/1-isolate/6-for-loops/README.md @@ -16,7 +16,7 @@ conventionally used? ```js for (initialization; condition; finalExpression) { - // ... loop body ... + // ... loop body ... } ``` @@ -37,15 +37,15 @@ The correct answer is `2`: ```js for ( - // 2: declare and assign the `step` variable - let step = 0; // initialization - // 3, 6, 9, 12: check if `step` is less than 3 - step < 3; // condition - // 5, 8, 11: add 1 to `step` - step++ // finalExpression + // 2: declare and assign the `step` variable + let step = 0; // initialization + // 3, 6, 9, 12: check if `step` is less than 3 + step < 3; // condition + // 5, 8, 11: add 1 to `step` + step++ // finalExpression ) { - // 4, 7, 10: log the current value of `step` - console.log(step); + // 4, 7, 10: log the current value of `step` + console.log(step); } ``` @@ -74,14 +74,14 @@ let max = 3; let step = 0; // condition while (step < max) { - console.log(step); - // final expression - step = step + 1; + console.log(step); + // final expression + step = step + 1; } // initialization; condition; finalExpression for (let step = 0; step < max; step++) { - console.log(step); + console.log(step); } ``` @@ -91,7 +91,7 @@ _variables_ button): ```js for (let step = 0; step < 3; step++) { - console.log(step); + console.log(step); } step; // ReferenceError @@ -122,13 +122,13 @@ let totalRepetitions = 4; let repeatedString = ''; for (let i = 0; i < totalRepetitions; i++) { - repeatedString += toRepeat; - console.log('repeatedString:', repeatedString); + repeatedString += toRepeat; + console.log('repeatedString:', repeatedString); } console.assert( - repeatedString === 'howdyhowdyhowdyhowdy', - '"howdy" should be repeated 4 times', + repeatedString === 'howdyhowdyhowdyhowdy', + '"howdy" should be repeated 4 times', ); ``` @@ -149,14 +149,14 @@ let reversedString = ''; console.log('reversedString:', reversedString); for (_; _; _) { - let nextLetter = _; - reversedString = _ + _; - console.log('reversedString:', reversedString); + let nextLetter = _; + reversedString = _ + _; + console.log('reversedString:', reversedString); } console.assert( - reversedString === 'mlkj', - 'reversed string is the original reversed', + reversedString === 'mlkj', + 'reversed string is the original reversed', ); ``` diff --git a/2-control-flow/1-isolate/6-for-loops/examples/1-for-many-lines.js b/03-control-flow/1-isolate/6-for-loops/examples/1-for-many-lines.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/examples/1-for-many-lines.js rename to 03-control-flow/1-isolate/6-for-loops/examples/1-for-many-lines.js diff --git a/2-control-flow/1-isolate/6-for-loops/examples/2-for-one-line.js b/03-control-flow/1-isolate/6-for-loops/examples/2-for-one-line.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/examples/2-for-one-line.js rename to 03-control-flow/1-isolate/6-for-loops/examples/2-for-one-line.js diff --git a/2-control-flow/1-isolate/6-for-loops/examples/3-for-infinite.js b/03-control-flow/1-isolate/6-for-loops/examples/3-for-infinite.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/examples/3-for-infinite.js rename to 03-control-flow/1-isolate/6-for-loops/examples/3-for-infinite.js diff --git a/2-control-flow/1-isolate/6-for-loops/examples/4-iterating-over-strings.js b/03-control-flow/1-isolate/6-for-loops/examples/4-iterating-over-strings.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/examples/4-iterating-over-strings.js rename to 03-control-flow/1-isolate/6-for-loops/examples/4-iterating-over-strings.js diff --git a/2-control-flow/1-isolate/6-for-loops/examples/5-const.js b/03-control-flow/1-isolate/6-for-loops/examples/5-const.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/examples/5-const.js rename to 03-control-flow/1-isolate/6-for-loops/examples/5-const.js diff --git a/2-control-flow/1-isolate/6-for-loops/exercises/1-parsons/count-to-10-in-5-steps.js b/03-control-flow/1-isolate/6-for-loops/exercises/1-parsons/count-to-10-in-5-steps.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/exercises/1-parsons/count-to-10-in-5-steps.js rename to 03-control-flow/1-isolate/6-for-loops/exercises/1-parsons/count-to-10-in-5-steps.js diff --git a/2-control-flow/1-isolate/6-for-loops/exercises/1-parsons/loop-head-syntax.js b/03-control-flow/1-isolate/6-for-loops/exercises/1-parsons/loop-head-syntax.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/exercises/1-parsons/loop-head-syntax.js rename to 03-control-flow/1-isolate/6-for-loops/exercises/1-parsons/loop-head-syntax.js diff --git a/2-control-flow/1-isolate/6-for-loops/exercises/1-parsons/reverse-a-string.js b/03-control-flow/1-isolate/6-for-loops/exercises/1-parsons/reverse-a-string.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/exercises/1-parsons/reverse-a-string.js rename to 03-control-flow/1-isolate/6-for-loops/exercises/1-parsons/reverse-a-string.js diff --git a/03-control-flow/1-isolate/6-for-loops/exercises/1-parsons/study.json b/03-control-flow/1-isolate/6-for-loops/exercises/1-parsons/study.json new file mode 100644 index 0000000..71e7a1a --- /dev/null +++ b/03-control-flow/1-isolate/6-for-loops/exercises/1-parsons/study.json @@ -0,0 +1,9 @@ +{ + "--defaults": { + ".js": "parsons" + }, + "parsons": { + "run": true, + "trace": true + } +} diff --git a/2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/1-stepping-up.js b/03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/1-stepping-up.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/1-stepping-up.js rename to 03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/1-stepping-up.js diff --git a/2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/2-stepping-down.js b/03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/2-stepping-down.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/2-stepping-down.js rename to 03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/2-stepping-down.js diff --git a/2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/3-uppercasify.js b/03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/3-uppercasify.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/3-uppercasify.js rename to 03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/3-uppercasify.js diff --git a/2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/4-reverse-string.js b/03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/4-reverse-string.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/4-reverse-string.js rename to 03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/4-reverse-string.js diff --git a/2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/5-reversicasify.js b/03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/5-reversicasify.js similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/exercises/2-blanks/5-reversicasify.js rename to 03-control-flow/1-isolate/6-for-loops/exercises/2-blanks/5-reversicasify.js diff --git a/2-control-flow/1-isolate/6-for-loops/for-loop-diagram.jpeg b/03-control-flow/1-isolate/6-for-loops/for-loop-diagram.jpeg similarity index 100% rename from 2-control-flow/1-isolate/6-for-loops/for-loop-diagram.jpeg rename to 03-control-flow/1-isolate/6-for-loops/for-loop-diagram.jpeg diff --git a/2-control-flow/1-isolate/7-refactoring-loops/README.md b/03-control-flow/1-isolate/7-refactoring-loops/README.md similarity index 100% rename from 2-control-flow/1-isolate/7-refactoring-loops/README.md rename to 03-control-flow/1-isolate/7-refactoring-loops/README.md diff --git a/2-control-flow/1-isolate/7-refactoring-loops/examples/1-for-of.js b/03-control-flow/1-isolate/7-refactoring-loops/examples/1-for-of.js similarity index 100% rename from 2-control-flow/1-isolate/7-refactoring-loops/examples/1-for-of.js rename to 03-control-flow/1-isolate/7-refactoring-loops/examples/1-for-of.js diff --git a/2-control-flow/1-isolate/7-refactoring-loops/examples/2-for.js b/03-control-flow/1-isolate/7-refactoring-loops/examples/2-for.js similarity index 100% rename from 2-control-flow/1-isolate/7-refactoring-loops/examples/2-for.js rename to 03-control-flow/1-isolate/7-refactoring-loops/examples/2-for.js diff --git a/2-control-flow/1-isolate/7-refactoring-loops/examples/3-while.js b/03-control-flow/1-isolate/7-refactoring-loops/examples/3-while.js similarity index 100% rename from 2-control-flow/1-isolate/7-refactoring-loops/examples/3-while.js rename to 03-control-flow/1-isolate/7-refactoring-loops/examples/3-while.js diff --git a/2-control-flow/1-isolate/7-refactoring-loops/exercises/1.js b/03-control-flow/1-isolate/7-refactoring-loops/exercises/1.js similarity index 100% rename from 2-control-flow/1-isolate/7-refactoring-loops/exercises/1.js rename to 03-control-flow/1-isolate/7-refactoring-loops/exercises/1.js diff --git a/2-control-flow/1-isolate/7-refactoring-loops/exercises/2.js b/03-control-flow/1-isolate/7-refactoring-loops/exercises/2.js similarity index 100% rename from 2-control-flow/1-isolate/7-refactoring-loops/exercises/2.js rename to 03-control-flow/1-isolate/7-refactoring-loops/exercises/2.js diff --git a/03-control-flow/1-isolate/study.json b/03-control-flow/1-isolate/study.json new file mode 100644 index 0000000..b666c63 --- /dev/null +++ b/03-control-flow/1-isolate/study.json @@ -0,0 +1,6 @@ +{ + "study": { + "openIn": "jsTutorLive", + "ask": false + } +} diff --git a/2-control-flow/2-integrate/0-prompt-alert-confirm/examples/alert.js b/03-control-flow/2-integrate/0-prompt-alert-confirm/examples/alert.js similarity index 100% rename from 2-control-flow/2-integrate/0-prompt-alert-confirm/examples/alert.js rename to 03-control-flow/2-integrate/0-prompt-alert-confirm/examples/alert.js diff --git a/2-control-flow/2-integrate/0-prompt-alert-confirm/examples/confirm.js b/03-control-flow/2-integrate/0-prompt-alert-confirm/examples/confirm.js similarity index 100% rename from 2-control-flow/2-integrate/0-prompt-alert-confirm/examples/confirm.js rename to 03-control-flow/2-integrate/0-prompt-alert-confirm/examples/confirm.js diff --git a/2-control-flow/2-integrate/0-prompt-alert-confirm/examples/prompt.js b/03-control-flow/2-integrate/0-prompt-alert-confirm/examples/prompt.js similarity index 100% rename from 2-control-flow/2-integrate/0-prompt-alert-confirm/examples/prompt.js rename to 03-control-flow/2-integrate/0-prompt-alert-confirm/examples/prompt.js diff --git a/2-control-flow/2-integrate/0-prompt-alert-confirm/exercises/1.js b/03-control-flow/2-integrate/0-prompt-alert-confirm/exercises/1.js similarity index 100% rename from 2-control-flow/2-integrate/0-prompt-alert-confirm/exercises/1.js rename to 03-control-flow/2-integrate/0-prompt-alert-confirm/exercises/1.js diff --git a/2-control-flow/2-integrate/0-prompt-alert-confirm/exercises/2.js b/03-control-flow/2-integrate/0-prompt-alert-confirm/exercises/2.js similarity index 100% rename from 2-control-flow/2-integrate/0-prompt-alert-confirm/exercises/2.js rename to 03-control-flow/2-integrate/0-prompt-alert-confirm/exercises/2.js diff --git a/2-control-flow/2-integrate/0-prompt-alert-confirm/exercises/3.js b/03-control-flow/2-integrate/0-prompt-alert-confirm/exercises/3.js similarity index 100% rename from 2-control-flow/2-integrate/0-prompt-alert-confirm/exercises/3.js rename to 03-control-flow/2-integrate/0-prompt-alert-confirm/exercises/3.js diff --git a/03-control-flow/2-integrate/0-prompt-alert-confirm/study.json b/03-control-flow/2-integrate/0-prompt-alert-confirm/study.json new file mode 100644 index 0000000..9ad041e --- /dev/null +++ b/03-control-flow/2-integrate/0-prompt-alert-confirm/study.json @@ -0,0 +1,9 @@ +{ + "study": { + "flowchart": true, + "loopGuard": { + "active": true, + "max": 20 + } + } +} diff --git a/2-control-flow/2-integrate/1-conditionals/examples/1-confirm-boolean-input.js b/03-control-flow/2-integrate/1-conditionals/examples/1-confirm-boolean-input.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/examples/1-confirm-boolean-input.js rename to 03-control-flow/2-integrate/1-conditionals/examples/1-confirm-boolean-input.js diff --git a/2-control-flow/2-integrate/1-conditionals/examples/2-prompt-empty-input.js b/03-control-flow/2-integrate/1-conditionals/examples/2-prompt-empty-input.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/examples/2-prompt-empty-input.js rename to 03-control-flow/2-integrate/1-conditionals/examples/2-prompt-empty-input.js diff --git a/2-control-flow/2-integrate/1-conditionals/examples/3-prompt-string-input.js b/03-control-flow/2-integrate/1-conditionals/examples/3-prompt-string-input.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/examples/3-prompt-string-input.js rename to 03-control-flow/2-integrate/1-conditionals/examples/3-prompt-string-input.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/remembery/0-complete.re.js b/03-control-flow/2-integrate/1-conditionals/exercises/remembery/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/remembery/0-complete.re.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/remembery/0-complete.re.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/remembery/1-blanks.js b/03-control-flow/2-integrate/1-conditionals/exercises/remembery/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/remembery/1-blanks.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/remembery/1-blanks.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/remembery/2-bugs.js b/03-control-flow/2-integrate/1-conditionals/exercises/remembery/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/remembery/2-bugs.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/remembery/2-bugs.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/remembery/3-goals.js b/03-control-flow/2-integrate/1-conditionals/exercises/remembery/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/remembery/3-goals.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/remembery/3-goals.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/remembery/4-empty.js b/03-control-flow/2-integrate/1-conditionals/exercises/remembery/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/remembery/4-empty.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/remembery/4-empty.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/0-complete.re.js b/03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/0-complete.re.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/0-complete.re.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/1-blanks.js b/03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/1-blanks.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/1-blanks.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/2-bugs.js b/03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/2-bugs.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/2-bugs.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/3-goals.js b/03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/3-goals.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/3-goals.js diff --git a/2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/4-empty.js b/03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/4-empty.js rename to 03-control-flow/2-integrate/1-conditionals/exercises/two-player-remembery/4-empty.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/README.md b/03-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/README.md similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/README.md rename to 03-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/README.md diff --git a/2-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/boolean-flag-variable.js b/03-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/boolean-flag-variable.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/boolean-flag-variable.js rename to 03-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/boolean-flag-variable.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/logic-in-head.js b/03-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/logic-in-head.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/logic-in-head.js rename to 03-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/logic-in-head.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/true-break-continue.js b/03-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/true-break-continue.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/true-break-continue.js rename to 03-control-flow/2-integrate/2-input-output-loops/examples/1-loop-control-strategies/true-break-continue.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/examples/2-searching-strings/1-string-dot-includes.js b/03-control-flow/2-integrate/2-input-output-loops/examples/2-searching-strings/1-string-dot-includes.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/examples/2-searching-strings/1-string-dot-includes.js rename to 03-control-flow/2-integrate/2-input-output-loops/examples/2-searching-strings/1-string-dot-includes.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/examples/2-searching-strings/2-to-lower-case.js b/03-control-flow/2-integrate/2-input-output-loops/examples/2-searching-strings/2-to-lower-case.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/examples/2-searching-strings/2-to-lower-case.js rename to 03-control-flow/2-integrate/2-input-output-loops/examples/2-searching-strings/2-to-lower-case.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/examples/3-programs/1-for-character-of-string.js b/03-control-flow/2-integrate/2-input-output-loops/examples/3-programs/1-for-character-of-string.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/examples/3-programs/1-for-character-of-string.js rename to 03-control-flow/2-integrate/2-input-output-loops/examples/3-programs/1-for-character-of-string.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/examples/3-programs/2-for-let-i-less-than-length.js b/03-control-flow/2-integrate/2-input-output-loops/examples/3-programs/2-for-let-i-less-than-length.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/examples/3-programs/2-for-let-i-less-than-length.js rename to 03-control-flow/2-integrate/2-input-output-loops/examples/3-programs/2-for-let-i-less-than-length.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/examples/3-programs/3-guessing-game.js b/03-control-flow/2-integrate/2-input-output-loops/examples/3-programs/3-guessing-game.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/examples/3-programs/3-guessing-game.js rename to 03-control-flow/2-integrate/2-input-output-loops/examples/3-programs/3-guessing-game.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/0-complete.re.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/0-complete.re.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/0-complete.re.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/1-blanks.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/1-blanks.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/1-blanks.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/2-bugs.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/2-bugs.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/2-bugs.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/3-goals.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/3-goals.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/3-goals.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/4-empty.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/4-empty.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/1-frogopedia/4-empty.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/0-complete.re.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/0-complete.re.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/0-complete.re.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/1-blanks.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/1-blanks.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/1-blanks.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/2-bugs.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/2-bugs.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/2-bugs.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/3-goals.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/3-goals.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/3-goals.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/4-empty.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/4-empty.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/2-confirming-input/4-empty.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/0-complete.re.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/0-complete.re.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/0-complete.re.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/1-blanks.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/1-blanks.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/1-blanks.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/2-bugs.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/2-bugs.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/2-bugs.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/3-goals.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/3-goals.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/3-goals.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/4-empty.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/4-empty.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/3-long-string/4-empty.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/0-complete.re.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/0-complete.re.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/0-complete.re.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/1-blanks.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/1-blanks.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/1-blanks.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/2-bugs.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/2-bugs.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/2-bugs.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/3-goals.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/3-goals.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/3-goals.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/4-empty.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/4-empty.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/4-e-at-5/4-empty.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/0-complete.re.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/0-complete.re.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/0-complete.re.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/1-blanks.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/1-blanks.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/1-blanks.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/2-bugs.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/2-bugs.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/2-bugs.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/3-goals.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/3-goals.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/3-goals.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/4-empty.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/4-empty.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/5-e-at-index/4-empty.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/0-complete.re.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/0-complete.re.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/0-complete.re.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/1-blanks.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/1-blanks.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/1-blanks.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/2-bugs.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/2-bugs.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/2-bugs.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/3-goals.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/3-goals.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/3-goals.js diff --git a/2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/4-empty.js b/03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/4-empty.js rename to 03-control-flow/2-integrate/2-input-output-loops/exercises/6-vowels-or-consonants/4-empty.js diff --git a/2-control-flow/2-integrate/3-numbers/examples/1-prompting-numbers.js b/03-control-flow/2-integrate/3-numbers/examples/1-prompting-numbers.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/examples/1-prompting-numbers.js rename to 03-control-flow/2-integrate/3-numbers/examples/1-prompting-numbers.js diff --git a/2-control-flow/2-integrate/3-numbers/examples/2-prompt-number-input.js b/03-control-flow/2-integrate/3-numbers/examples/2-prompt-number-input.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/examples/2-prompt-number-input.js rename to 03-control-flow/2-integrate/3-numbers/examples/2-prompt-number-input.js diff --git a/2-control-flow/2-integrate/3-numbers/examples/3-iterations.js b/03-control-flow/2-integrate/3-numbers/examples/3-iterations.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/examples/3-iterations.js rename to 03-control-flow/2-integrate/3-numbers/examples/3-iterations.js diff --git a/2-control-flow/2-integrate/3-numbers/examples/4-guessing-game.js b/03-control-flow/2-integrate/3-numbers/examples/4-guessing-game.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/examples/4-guessing-game.js rename to 03-control-flow/2-integrate/3-numbers/examples/4-guessing-game.js diff --git a/2-control-flow/2-integrate/3-numbers/examples/5-typing-practice.js b/03-control-flow/2-integrate/3-numbers/examples/5-typing-practice.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/examples/5-typing-practice.js rename to 03-control-flow/2-integrate/3-numbers/examples/5-typing-practice.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/1-validatron/0-complete.re.js b/03-control-flow/2-integrate/3-numbers/exercises/1-validatron/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/1-validatron/0-complete.re.js rename to 03-control-flow/2-integrate/3-numbers/exercises/1-validatron/0-complete.re.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/1-validatron/1-blanks.js b/03-control-flow/2-integrate/3-numbers/exercises/1-validatron/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/1-validatron/1-blanks.js rename to 03-control-flow/2-integrate/3-numbers/exercises/1-validatron/1-blanks.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/1-validatron/2-bugs.js b/03-control-flow/2-integrate/3-numbers/exercises/1-validatron/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/1-validatron/2-bugs.js rename to 03-control-flow/2-integrate/3-numbers/exercises/1-validatron/2-bugs.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/1-validatron/3-goals.js b/03-control-flow/2-integrate/3-numbers/exercises/1-validatron/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/1-validatron/3-goals.js rename to 03-control-flow/2-integrate/3-numbers/exercises/1-validatron/3-goals.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/1-validatron/4-empty.js b/03-control-flow/2-integrate/3-numbers/exercises/1-validatron/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/1-validatron/4-empty.js rename to 03-control-flow/2-integrate/3-numbers/exercises/1-validatron/4-empty.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/0-complete.re.js b/03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/0-complete.re.js rename to 03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/0-complete.re.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/1-blanks.js b/03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/1-blanks.js rename to 03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/1-blanks.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/2-bugs.js b/03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/2-bugs.js rename to 03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/2-bugs.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/3-goals.js b/03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/3-goals.js rename to 03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/3-goals.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/4-empty.js b/03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/4-empty.js rename to 03-control-flow/2-integrate/3-numbers/exercises/2-even-odd-sorter/4-empty.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/0-complete.re.js b/03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/0-complete.re.js rename to 03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/0-complete.re.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/1-blanks.js b/03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/1-blanks.js rename to 03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/1-blanks.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/2-bugs.js b/03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/2-bugs.js rename to 03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/2-bugs.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/3-goals.js b/03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/3-goals.js rename to 03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/3-goals.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/4-empty.js b/03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/4-empty.js rename to 03-control-flow/2-integrate/3-numbers/exercises/3-repeat-string/4-empty.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/4-sum/0-complete.re.js b/03-control-flow/2-integrate/3-numbers/exercises/4-sum/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/4-sum/0-complete.re.js rename to 03-control-flow/2-integrate/3-numbers/exercises/4-sum/0-complete.re.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/4-sum/1-blanks.js b/03-control-flow/2-integrate/3-numbers/exercises/4-sum/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/4-sum/1-blanks.js rename to 03-control-flow/2-integrate/3-numbers/exercises/4-sum/1-blanks.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/4-sum/2-bugs.js b/03-control-flow/2-integrate/3-numbers/exercises/4-sum/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/4-sum/2-bugs.js rename to 03-control-flow/2-integrate/3-numbers/exercises/4-sum/2-bugs.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/4-sum/3-goals.js b/03-control-flow/2-integrate/3-numbers/exercises/4-sum/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/4-sum/3-goals.js rename to 03-control-flow/2-integrate/3-numbers/exercises/4-sum/3-goals.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/4-sum/4-empty.js b/03-control-flow/2-integrate/3-numbers/exercises/4-sum/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/4-sum/4-empty.js rename to 03-control-flow/2-integrate/3-numbers/exercises/4-sum/4-empty.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/5-average/0-complete.re.js b/03-control-flow/2-integrate/3-numbers/exercises/5-average/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/5-average/0-complete.re.js rename to 03-control-flow/2-integrate/3-numbers/exercises/5-average/0-complete.re.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/5-average/1-blanks.js b/03-control-flow/2-integrate/3-numbers/exercises/5-average/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/5-average/1-blanks.js rename to 03-control-flow/2-integrate/3-numbers/exercises/5-average/1-blanks.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/5-average/2-bugs.js b/03-control-flow/2-integrate/3-numbers/exercises/5-average/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/5-average/2-bugs.js rename to 03-control-flow/2-integrate/3-numbers/exercises/5-average/2-bugs.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/5-average/3-goals.js b/03-control-flow/2-integrate/3-numbers/exercises/5-average/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/5-average/3-goals.js rename to 03-control-flow/2-integrate/3-numbers/exercises/5-average/3-goals.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/5-average/4-empty.js b/03-control-flow/2-integrate/3-numbers/exercises/5-average/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/5-average/4-empty.js rename to 03-control-flow/2-integrate/3-numbers/exercises/5-average/4-empty.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/0-complete.re.js b/03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/0-complete.re.js rename to 03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/0-complete.re.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/1-blanks.js b/03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/1-blanks.js rename to 03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/1-blanks.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/2-bugs.js b/03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/2-bugs.js rename to 03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/2-bugs.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/3-goals.js b/03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/3-goals.js rename to 03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/3-goals.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/4-empty.js b/03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/4-empty.js rename to 03-control-flow/2-integrate/3-numbers/exercises/6-unicode-shuffle/4-empty.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/0-complete.re.js b/03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/0-complete.re.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/0-complete.re.js rename to 03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/0-complete.re.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/1-blanks.js b/03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/1-blanks.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/1-blanks.js rename to 03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/1-blanks.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/2-bugs.js b/03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/2-bugs.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/2-bugs.js rename to 03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/2-bugs.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/3-goals.js b/03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/3-goals.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/3-goals.js rename to 03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/3-goals.js diff --git a/2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/4-empty.js b/03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/4-empty.js similarity index 100% rename from 2-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/4-empty.js rename to 03-control-flow/2-integrate/3-numbers/exercises/7-repeat-characters/4-empty.js diff --git a/2-control-flow/2-integrate/README.md b/03-control-flow/2-integrate/README.md similarity index 100% rename from 2-control-flow/2-integrate/README.md rename to 03-control-flow/2-integrate/README.md diff --git a/03-control-flow/2-integrate/study.json b/03-control-flow/2-integrate/study.json new file mode 100644 index 0000000..9ad041e --- /dev/null +++ b/03-control-flow/2-integrate/study.json @@ -0,0 +1,9 @@ +{ + "study": { + "flowchart": true, + "loopGuard": { + "active": true, + "max": 20 + } + } +} diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/index.html b/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/index.html new file mode 100644 index 0000000..15534df --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/index.html @@ -0,0 +1,35 @@ + + + + + +
+ +your output:
+ + +
+ +expected output:
+ +multiplication + + + + + ++ + + + + + + + + + diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/script.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/script.js new file mode 100644 index 0000000..0f25da1 --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/script.js @@ -0,0 +1,23 @@ +'use strict'; + +/* Multiplication + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- user interaction --- + +_._(_, () => { + debugger; + + // read user values + + // use a for loop and addition to multiply the two numbers + + // display the product +}); diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/script.re.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/script.re.js new file mode 100644 index 0000000..3269bb2 --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/script.re.js @@ -0,0 +1,87 @@ +const _0x5bc63e = _0x8797; +!(function (n, t) { + const r = _0x8797, + e = _0x3417(); + for (;;) + try { + if ( + 242312 === + (-parseInt(r(319)) / 1) * (-parseInt(r(316)) / 2) + + (-parseInt(r(333)) / 3) * (-parseInt(r(322)) / 4) + + (parseInt(r(337)) / 5) * (-parseInt(r(321)) / 6) + + parseInt(r(335)) / 7 + + (-parseInt(r(328)) / 8) * (-parseInt(r(327)) / 9) + + parseInt(r(315)) / 10 + + -parseInt(r(318)) / 11 + ) + break; + e.push(e.shift()); + } catch (n) { + e.push(e.shift()); + } +})(); +import { + whenButtonIsClicked, + readNumber, + displayString, +} from '../../../../../lib/dom-io/index.js'; +function _0x3417() { + const n = [ + 'do-math', + '9466677RHcSje', + '250971TfyEvf', + 'eEnPF', + '2591106arJelo', + '8GgWMPf', + 'left', + 'nCNYr', + 'right', + 'uduVI', + '5013AqASTR', + '4376NJtayd', + 'secret-solution', + 'qOUaD', + 'fgNQQ', + 'RFsIl', + '442164hzziHS', + 'a * b -> ', + '2971997EvuWhk', + 'mUZvO', + '5ESrgHz', + '2597730VmQakJ', + '2kDCaiy', + ]; + return (_0x3417 = function () { + return n; + })(); +} +function _0x8797(n, t) { + const r = _0x3417(); + return (_0x8797 = function (n, t) { + return r[(n -= 315)]; + })(n, t); +} +whenButtonIsClicked(_0x5bc63e(317), () => { + const n = _0x5bc63e, + t = { + nCNYr: function (n, t) { + return n(t); + }, + fgNQQ: n(323), + mUZvO: function (n, t) { + return n(t); + }, + qOUaD: n(325), + RFsIl: function (n, t) { + return n * t; + }, + uduVI: function (n, t, r) { + return n(t, r); + }, + eEnPF: n(329), + }, + r = t[n(324)](readNumber, t[n(331)]), + e = t[n(336)](readNumber, t[n(330)]), + u = n(334) + t[n(332)](r, e); + t[n(326)](displayString, t[n(320)], u); +}); diff --git a/6-using-functions/5-dom-io/multiplication/styles.css b/03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/styles.css similarity index 100% rename from 6-using-functions/5-dom-io/multiplication/styles.css rename to 03-control-flow/3-dom-ui/exercises/reverse-engineering/multiplication/styles.css diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/index.html b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/index.html new file mode 100644 index 0000000..41c0c0a --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/index.html @@ -0,0 +1,35 @@ + + + + + +
+ +your output: + + +
+ +expected output: + +repeat characters + + + + + ++ + + + + + + + + + diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/script.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/script.js new file mode 100644 index 0000000..0e38b06 --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/script.js @@ -0,0 +1,27 @@ +'use strict'; + +/* Repeat Characters + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- user interaction --- + +_._(_, () => { + debugger; + + // read user values + + // repeat the characters in the text + + for (_; _; _) { + for (_; _; _) {} + } + + // display the text with repeated characters +}); diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/script.re.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/script.re.js new file mode 100644 index 0000000..4b01abd --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/script.re.js @@ -0,0 +1,91 @@ +const _0x193672 = _0x4c8f; +function _0x1ff9() { + const n = [ + 'ution', + 'user-text', + 'nXfYs', + 'number-of-', + '2891125hrcMGY', + '54750dkmJEI', + '2658bGNGqb', + 'nOrWu', + '2513104dtnpFq', + 'FxzRG', + '792UnsBli', + '70CNLfpu', + 'secret-sol', + 'repeat-the', + '100FZNoZp', + 'fntcZ', + '52030IDjDRe', + 'entPl', + '10CNHWJj', + '1134711puhxwJ', + 'bhlNo', + '7Pivqqw', + 'kmWxk', + '2947962nwyaFk', + 'times', + ]; + return (_0x1ff9 = function () { + return n; + })(); +} +function _0x4c8f(n, t) { + const r = _0x1ff9(); + return (_0x4c8f = function (n, t) { + return r[(n -= 426)]; + })(n, t); +} +!(function (n, t) { + const r = _0x4c8f, + e = _0x1ff9(); + for (;;) + try { + if ( + 338261 === + (parseInt(r(445)) / 1) * (parseInt(r(440)) / 2) + + (-parseInt(r(439)) / 3) * (-parseInt(r(448)) / 4) + + -parseInt(r(438)) / 5 + + (parseInt(r(432)) / 6) * (parseInt(r(430)) / 7) + + parseInt(r(442)) / 8 + + (parseInt(r(428)) / 9) * (-parseInt(r(427)) / 10) + + (parseInt(r(450)) / 11) * (-parseInt(r(444)) / 12) + ) + break; + e.push(e.shift()); + } catch (n) { + e.push(e.shift()); + } +})(); +import { + whenButtonIsClicked, + readNumber, + readString, + displayString, +} from '../../../../../lib/dom-io/index.js'; +whenButtonIsClicked(_0x193672(447) + 'm', () => { + const n = _0x193672, + t = { + bhlNo: function (n, t) { + return n(t); + }, + nXfYs: n(435), + entPl: function (n, t) { + return n(t); + }, + FxzRG: n(437) + n(433), + nOrWu: function (n, t) { + return n < t; + }, + fntcZ: function (n, t, r) { + return n(t, r); + }, + kmWxk: n(446) + n(434), + }, + r = t[n(429)](readString, t[n(436)]), + e = t[n(426)](readNumber, t[n(443)]); + let f = ''; + for (const s of r) for (let r = 0; t[n(441)](r, e); r++) f += s; + t[n(449)](displayString, t[n(431)], f); +}); diff --git a/6-using-functions/5-dom-io/repeat-characters/styles.css b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/styles.css similarity index 100% rename from 6-using-functions/5-dom-io/repeat-characters/styles.css rename to 03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-characters/styles.css diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/index.html b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/index.html new file mode 100644 index 0000000..1ede513 --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/index.html @@ -0,0 +1,33 @@ + + + + + +
+ +your output: + + +
+ +expected output: + +repeat string + + + + + ++ repeat this string: + + + + + diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/script.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/script.js new file mode 100644 index 0000000..c029c97 --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/script.js @@ -0,0 +1,23 @@ +'use strict'; + +/* Repeat String + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- user interaction --- + +_.addEventListener('click', () => { + debugger; + + // read user values + + // repeat the string + + // display the repeated string +}); diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/script.re.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/script.re.js new file mode 100644 index 0000000..94dcd4e --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/script.re.js @@ -0,0 +1,91 @@ +function _0x364d() { + const t = [ + 'addEventLi', + 'stener', + '19969050iXGEmW', + 'ution', + 'rlmtC', + '37176xDqwGw', + 'number-of-', + '15vEcczn', + 'ById', + '6921702YqBkwt', + '410862hKLsbi', + 'cVVnX', + '651ihODJx', + 'wXtXa', + 'secret-sol', + 'repeat-it', + '2506018COgcFU', + 'click', + '15963UiJIHi', + 'getElement', + 'gLqRE', + '544KDZhZk', + 'user-text', + '1221794wbCcAS', + 'eBpLS', + 'TUmrR', + 'times', + ]; + return (_0x364d = function () { + return t; + })(); +} +const _0x42f7a6 = _0x4d63; +!(function (t, n) { + const r = _0x4d63, + e = _0x364d(); + for (;;) + try { + if ( + 788096 === + -parseInt(r(419)) / 1 + + -parseInt(r(412)) / 2 + + (parseInt(r(414)) / 3) * (parseInt(r(417)) / 4) + + (-parseInt(r(403)) / 5) * (-parseInt(r(406)) / 6) + + (-parseInt(r(408)) / 7) * (parseInt(r(401)) / 8) + + parseInt(r(405)) / 9 + + parseInt(r(398)) / 10 + ) + break; + e.push(e.shift()); + } catch (t) { + e.push(e.shift()); + } +})(); +import { + readNumber, + readString, + displayString, +} from '../../../lib/dom-io/index.js'; +function _0x4d63(t, n) { + const r = _0x364d(); + return (_0x4d63 = function (t, n) { + return r[(t -= 398)]; + })(t, n); +} +document[_0x42f7a6(415) + _0x42f7a6(404)](_0x42f7a6(411))[ + _0x42f7a6(423) + _0x42f7a6(424) +](_0x42f7a6(413), () => { + const t = _0x42f7a6, + n = { + gLqRE: function (t, n) { + return t(n); + }, + wXtXa: t(418), + TUmrR: t(402) + t(422), + eBpLS: function (t, n) { + return t < n; + }, + rlmtC: function (t, n, r) { + return t(n, r); + }, + cVVnX: t(410) + t(399), + }, + r = n[t(416)](readString, n[t(409)]), + e = n[t(416)](readNumber, n[t(421)]); + let a = ''; + for (let i = 0; n[t(420)](i, e); i++) a += r; + n[t(400)](displayString, n[t(407)], a); +}); diff --git a/6-using-functions/5-dom-io/repeat-string/styles.css b/03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/styles.css similarity index 100% rename from 6-using-functions/5-dom-io/repeat-string/styles.css rename to 03-control-flow/3-dom-ui/exercises/reverse-engineering/repeat-string/styles.css diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/index.html b/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/index.html new file mode 100644 index 0000000..ee8770c --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/index.html @@ -0,0 +1,33 @@ + + + + + +
+ this many tines: +
+ + + +
+ +your output: + + +
+ +expected output: + +reverse string + + + + + ++ reverse this string: + + + + + diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/script.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/script.js new file mode 100644 index 0000000..01e21a6 --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/script.js @@ -0,0 +1,23 @@ +'use strict'; + +/* Reverse String + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- user interaction --- + +_.addEventListener('click', () => { + debugger; + + // read user text + + // use a for loop that counts down (i--) to reverse the input + + // display the reversed string +}); diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/script.re.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/script.re.js new file mode 100644 index 0000000..dd03f9a --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/script.re.js @@ -0,0 +1,88 @@ +const _0x314480 = _0x370b; +function _0x3c24() { + const t = [ + 'RtJAe', + '2sGralD', + 'ution', + 'saDJo', + 'ById', + '11489488ZhWQBl', + 'reverse-it', + 'user-text', + 'PplZc', + '5554779kYUBJS', + 'length', + '504351VdYWlJ', + '30791057fMjkQa', + 'addEventLi', + 'TFJuj', + 'secret-sol', + '14DkCpAs', + '580632BfYZPy', + '60CGixJZ', + 'stener', + 'JojXJ', + '310esptOT', + 'getElement', + 'ruBFK', + '5543508jBnoNq', + '1398001ZOSIdc', + 'click', + ]; + return (_0x3c24 = function () { + return t; + })(); +} +!(function (t, n) { + const r = _0x370b, + e = _0x3c24(); + for (;;) + try { + if ( + 943114 === + -parseInt(r(272)) / 1 + + (parseInt(r(275)) / 2) * (parseInt(r(283)) / 3) + + (-parseInt(r(291)) / 4) * (-parseInt(r(292)) / 5) + + (-parseInt(r(271)) / 6) * (-parseInt(r(290)) / 7) + + parseInt(r(279)) / 8 + + (-parseInt(r(285)) / 9) * (parseInt(r(295)) / 10) + + -parseInt(r(286)) / 11 + ) + break; + e.push(e.shift()); + } catch (t) { + e.push(e.shift()); + } +})(); +import { readString, displayString } from '../../../../../lib/dom-io/index.js'; +function _0x370b(t, n) { + const r = _0x3c24(); + return (_0x370b = function (t, n) { + return r[(t -= 269)]; + })(t, n); +} +document[_0x314480(269) + _0x314480(278)](_0x314480(280))[ + _0x314480(287) + _0x314480(293) +](_0x314480(273), () => { + const t = _0x314480, + n = { + ruBFK: function (t, n) { + return t(n); + }, + RtJAe: t(281), + PplZc: function (t, n) { + return t - n; + }, + JojXJ: function (t, n) { + return t >= n; + }, + TFJuj: function (t, n, r) { + return t(n, r); + }, + saDJo: t(289) + t(276), + }, + r = n[t(270)](readString, n[t(274)]); + let e = ''; + for (let s = n[t(282)](r[t(284)], 1); n[t(294)](s, 0); s--) e += r[s]; + n[t(288)](displayString, n[t(277)], e); +}); diff --git a/6-using-functions/5-dom-io/reverse-string/styles.css b/03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/styles.css similarity index 100% rename from 6-using-functions/5-dom-io/reverse-string/styles.css rename to 03-control-flow/3-dom-ui/exercises/reverse-engineering/reverse-string/styles.css diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/index.html b/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/index.html new file mode 100644 index 0000000..8b2f2fd --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/index.html @@ -0,0 +1,34 @@ + + + + + +
+ +
+ + + +
+ +your output: + + +
+ +expected output: + +skip + + + + + ++ skip this many characters: + + + + + + diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/script.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/script.js new file mode 100644 index 0000000..7e4c0ea --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/script.js @@ -0,0 +1,23 @@ +'use strict'; + +/* Skip + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- user interaction --- + +_.addEventListener('click', () => { + debugger; + + // read user values + + // create a new string with skipped characters + + // display the skipped string +}); diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/script.re.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/script.re.js new file mode 100644 index 0000000..7cca966 --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/script.re.js @@ -0,0 +1,96 @@ +function _0x5b54(n, t) { + const e = _0x2a56(); + return (_0x5b54 = function (n, t) { + return e[(n -= 199)]; + })(n, t); +} +function _0x2a56() { + const n = [ + 'kHICf', + 'XwHbC', + 'skip-them', + 'VsvhF', + '5463430cRDskf', + '4KEeUAy', + '46258641CmQbjR', + 'kffQS', + '12807wJnILJ', + 'addEventLi', + '2152FsYdQN', + 'HioKn', + 'stener', + 'skip-size', + 'user-text', + '552588OsvZEs', + 'ById', + '49XuJxYZ', + '64xBKQGk', + 'Uubme', + 'secret-sol', + 'click', + 'ution', + 'BLjwT', + 'getElement', + '3964173urgyfO', + '13071740pCVQqY', + 'length', + '1721nGSSIv', + ]; + return (_0x2a56 = function () { + return n; + })(); +} +const _0x1c928d = _0x5b54; +!(function (n, t) { + const e = _0x5b54, + r = _0x2a56(); + for (;;) + try { + if ( + 690907 === + (-parseInt(e(224)) / 1) * (parseInt(e(214)) / 2) + + -parseInt(e(221)) / 3 + + (parseInt(e(201)) / 4) * (-parseInt(e(200)) / 5) + + (-parseInt(e(211)) / 6) * (-parseInt(e(213)) / 7) + + (-parseInt(e(206)) / 8) * (parseInt(e(204)) / 9) + + -parseInt(e(222)) / 10 + + parseInt(e(202)) / 11 + ) + break; + r.push(r.shift()); + } catch (n) { + r.push(r.shift()); + } +})(); +import { + readNumber, + readString, + displayString, +} from '../../../lib/dom-io/index.js'; +document[_0x1c928d(220) + _0x1c928d(212)](_0x1c928d(227))[ + _0x1c928d(205) + _0x1c928d(208) +](_0x1c928d(217), () => { + const n = _0x1c928d, + t = { + HioKn: function (n, t) { + return n(t); + }, + kffQS: n(210), + Uubme: n(209), + kHICf: function (n, t) { + return n < t; + }, + VsvhF: function (n, t) { + return n + t; + }, + BLjwT: function (n, t, e) { + return n(t, e); + }, + XwHbC: n(216) + n(218), + }, + e = t[n(207)](readString, t[n(203)]), + r = t[n(207)](readNumber, t[n(215)]); + let s = ''; + for (let c = 0; t[n(225)](c, e[n(223)]); c = t[n(199)](c, r)) s += e[c]; + t[n(219)](displayString, t[n(226)], s); +}); diff --git a/6-using-functions/5-dom-io/skip/styles.css b/03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/styles.css similarity index 100% rename from 6-using-functions/5-dom-io/skip/styles.css rename to 03-control-flow/3-dom-ui/exercises/reverse-engineering/skip/styles.css diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/index.html b/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/index.html new file mode 100644 index 0000000..fcd90bd --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/index.html @@ -0,0 +1,34 @@ + + + + + +
+ in this text: +
+ + + +
+ +your output: + + +
+ +expected output: + +upside down pyramid + + + + + ++ create an upside down pyramid with this text: + + + + + + + + diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/script.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/script.js new file mode 100644 index 0000000..6f2cd66 --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/script.js @@ -0,0 +1,27 @@ +'use strict'; + +/* Upside-Down Pyramid + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- user interaction --- + +_.addEventListener('click', () => { + debugger; + + // read user text + + // create the pyramid + + for (_; _; _) { + for (_; _; _) {} + } + + // display the pyramid +}); diff --git a/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/script.re.js b/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/script.re.js new file mode 100644 index 0000000..e010898 --- /dev/null +++ b/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/script.re.js @@ -0,0 +1,90 @@ +const _0x249d7f = _0x517a; +function _0x517a(n, t) { + const r = _0x4fac(); + return (_0x517a = function (n, t) { + return r[(n -= 175)]; + })(n, t); +} +!(function (n, t) { + const r = _0x517a, + e = _0x4fac(); + for (;;) + try { + if ( + 641495 === + parseInt(r(193)) / 1 + + -parseInt(r(184)) / 2 + + (parseInt(r(195)) / 3) * (-parseInt(r(177)) / 4) + + (-parseInt(r(187)) / 5) * (parseInt(r(198)) / 6) + + parseInt(r(196)) / 7 + + parseInt(r(186)) / 8 + + (parseInt(r(199)) / 9) * (parseInt(r(178)) / 10) + ) + break; + e.push(e.shift()); + } catch (n) { + e.push(e.shift()); + } +})(); +import { readString, displayString } from '../../../../../lib/dom-io/index.js'; +function _0x4fac() { + const n = [ + 'to-pyramid', + '3340072QrvFwP', + '50930pLpoKj', + 'ution', + 'ById', + 'secret-sol', + 'ccDch', + 'getElement', + '2424030gpGmyH', + 'addEventLi', + '9265040iFTJJE', + '1940910mgQmNz', + 'length', + 'aYXJC', + 'pyramid-it', + 'bqqNJ', + 'qeRNO', + '999977NCkfOA', + 'sdFYm', + '3wHpAjJ', + '3407684jOdLws', + 'stener', + '12KYhpIp', + '1449MydWXK', + 'mnVKk', + 'click', + ]; + return (_0x4fac = function () { + return n; + })(); +} +document[_0x249d7f(183) + _0x249d7f(180)](_0x249d7f(190))[ + _0x249d7f(185) + _0x249d7f(197) +](_0x249d7f(175), () => { + const n = _0x249d7f, + t = { + sdFYm: function (n, t) { + return n(t); + }, + ccDch: n(176), + qeRNO: function (n, t) { + return n < t; + }, + mnVKk: function (n, t) { + return n < t; + }, + aYXJC: function (n, t, r) { + return n(t, r); + }, + bqqNJ: n(181) + n(179), + }, + r = t[n(194)](readString, t[n(182)]); + let e = ''; + for (let c = 0; t[n(192)](c, r[n(188)]); c++) { + for (let a = c; t[n(200)](a, r[n(188)]); a++) e += r[a]; + e += '\n'; + } + t[n(189)](displayString, t[n(191)], e); +}); diff --git a/6-using-functions/5-dom-io/upside-down-pyramid/styles.css b/03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/styles.css similarity index 100% rename from 6-using-functions/5-dom-io/upside-down-pyramid/styles.css rename to 03-control-flow/3-dom-ui/exercises/reverse-engineering/upside-down-pyramid/styles.css diff --git a/03-control-flow/README.md b/03-control-flow/README.md new file mode 100644 index 0000000..1278a07 --- /dev/null +++ b/03-control-flow/README.md @@ -0,0 +1,20 @@ +# Control Flow + +## 1. Isolate + +Practice reading, visualizing, tracing, debugging, refactoring and writing small +programs with control flow structures and no user interactions. + +## 2. Integrate + +Integrate the skills from **Isolate** into larger programs that use +`prompt`/`alert`/`confirm` to interact with the user. + +This collection of examples and exercises will also introduce different +strategies for processing user input and working with different primitive types +in an interactive program. + +## 3. DOM UI + +Apply your control flow skills in more complex event-driven programs that use +HTML, CSS & JavaScript to provide a full user interface. diff --git a/04-functions/.eslintrc.json b/04-functions/.eslintrc.json new file mode 100644 index 0000000..b4b7726 --- /dev/null +++ b/04-functions/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "camelcase": [0] + } +} diff --git a/3-functions/1-functions/README.md b/04-functions/1-functions/README.md similarity index 100% rename from 3-functions/1-functions/README.md rename to 04-functions/1-functions/README.md diff --git a/3-functions/1-functions/anatomy-of-a-function.png b/04-functions/1-functions/anatomy-of-a-function.png similarity index 100% rename from 3-functions/1-functions/anatomy-of-a-function.png rename to 04-functions/1-functions/anatomy-of-a-function.png diff --git a/3-functions/1-functions/examples/1-declaration-vs-execution.js b/04-functions/1-functions/examples/1-declaration-vs-execution.js similarity index 100% rename from 3-functions/1-functions/examples/1-declaration-vs-execution.js rename to 04-functions/1-functions/examples/1-declaration-vs-execution.js diff --git a/3-functions/1-functions/examples/2-parameters-and-arguments.js b/04-functions/1-functions/examples/2-parameters-and-arguments.js similarity index 100% rename from 3-functions/1-functions/examples/2-parameters-and-arguments.js rename to 04-functions/1-functions/examples/2-parameters-and-arguments.js diff --git a/3-functions/1-functions/examples/3-return-values.js b/04-functions/1-functions/examples/3-return-values.js similarity index 100% rename from 3-functions/1-functions/examples/3-return-values.js rename to 04-functions/1-functions/examples/3-return-values.js diff --git a/3-functions/1-functions/examples/4-tracing-execution.js b/04-functions/1-functions/examples/4-tracing-execution.js similarity index 100% rename from 3-functions/1-functions/examples/4-tracing-execution.js rename to 04-functions/1-functions/examples/4-tracing-execution.js diff --git a/3-functions/1-functions/examples/5-debugging-functions.js b/04-functions/1-functions/examples/5-debugging-functions.js similarity index 100% rename from 3-functions/1-functions/examples/5-debugging-functions.js rename to 04-functions/1-functions/examples/5-debugging-functions.js diff --git a/3-functions/1-functions/examples/6-lexical-scope.js b/04-functions/1-functions/examples/6-lexical-scope.js similarity index 100% rename from 3-functions/1-functions/examples/6-lexical-scope.js rename to 04-functions/1-functions/examples/6-lexical-scope.js diff --git a/3-functions/1-functions/examples/7-function-name.js b/04-functions/1-functions/examples/7-function-name.js similarity index 100% rename from 3-functions/1-functions/examples/7-function-name.js rename to 04-functions/1-functions/examples/7-function-name.js diff --git a/3-functions/1-functions/exercises/0-example-scramble.js b/04-functions/1-functions/exercises/0-example-scramble.js similarity index 100% rename from 3-functions/1-functions/exercises/0-example-scramble.js rename to 04-functions/1-functions/exercises/0-example-scramble.js diff --git a/3-functions/1-functions/exercises/1-write-expected.js b/04-functions/1-functions/exercises/1-write-expected.js similarity index 100% rename from 3-functions/1-functions/exercises/1-write-expected.js rename to 04-functions/1-functions/exercises/1-write-expected.js diff --git a/3-functions/1-functions/exercises/2-write-arguments.js b/04-functions/1-functions/exercises/2-write-arguments.js similarity index 100% rename from 3-functions/1-functions/exercises/2-write-arguments.js rename to 04-functions/1-functions/exercises/2-write-arguments.js diff --git a/3-functions/1-functions/exercises/3-write-function.js b/04-functions/1-functions/exercises/3-write-function.js similarity index 100% rename from 3-functions/1-functions/exercises/3-write-function.js rename to 04-functions/1-functions/exercises/3-write-function.js diff --git a/3-functions/2-documenting-functions/README.md b/04-functions/2-documenting-functions/README.md similarity index 100% rename from 3-functions/2-documenting-functions/README.md rename to 04-functions/2-documenting-functions/README.md diff --git a/3-functions/2-documenting-functions/examples/1-default-parameters.js b/04-functions/2-documenting-functions/examples/1-default-parameters.js similarity index 100% rename from 3-functions/2-documenting-functions/examples/1-default-parameters.js rename to 04-functions/2-documenting-functions/examples/1-default-parameters.js diff --git a/3-functions/2-documenting-functions/examples/2-jsdoc-comments.js b/04-functions/2-documenting-functions/examples/2-jsdoc-comments.js similarity index 100% rename from 3-functions/2-documenting-functions/examples/2-jsdoc-comments.js rename to 04-functions/2-documenting-functions/examples/2-jsdoc-comments.js diff --git a/3-functions/2-documenting-functions/examples/3-scrambler.js b/04-functions/2-documenting-functions/examples/3-scrambler.js similarity index 100% rename from 3-functions/2-documenting-functions/examples/3-scrambler.js rename to 04-functions/2-documenting-functions/examples/3-scrambler.js diff --git a/3-functions/2-documenting-functions/examples/4-reverser.js b/04-functions/2-documenting-functions/examples/4-reverser.js similarity index 100% rename from 3-functions/2-documenting-functions/examples/4-reverser.js rename to 04-functions/2-documenting-functions/examples/4-reverser.js diff --git a/3-functions/2-documenting-functions/exercises/1-long-or-short.js b/04-functions/2-documenting-functions/exercises/1-long-or-short.js similarity index 100% rename from 3-functions/2-documenting-functions/exercises/1-long-or-short.js rename to 04-functions/2-documenting-functions/exercises/1-long-or-short.js diff --git a/3-functions/2-documenting-functions/exercises/2-is-palindrome.js b/04-functions/2-documenting-functions/exercises/2-is-palindrome.js similarity index 100% rename from 3-functions/2-documenting-functions/exercises/2-is-palindrome.js rename to 04-functions/2-documenting-functions/exercises/2-is-palindrome.js diff --git a/3-functions/2-documenting-functions/exercises/3-count-character.js b/04-functions/2-documenting-functions/exercises/3-count-character.js similarity index 100% rename from 3-functions/2-documenting-functions/exercises/3-count-character.js rename to 04-functions/2-documenting-functions/exercises/3-count-character.js diff --git a/3-functions/2-documenting-functions/exercises/4-skip-characters.js b/04-functions/2-documenting-functions/exercises/4-skip-characters.js similarity index 100% rename from 3-functions/2-documenting-functions/exercises/4-skip-characters.js rename to 04-functions/2-documenting-functions/exercises/4-skip-characters.js diff --git a/3-functions/2-documenting-functions/exercises/5-unicode-shuffle.js b/04-functions/2-documenting-functions/exercises/5-unicode-shuffle.js similarity index 100% rename from 3-functions/2-documenting-functions/exercises/5-unicode-shuffle.js rename to 04-functions/2-documenting-functions/exercises/5-unicode-shuffle.js diff --git a/3-functions/3-the-callstack/1-the-call-stack.js b/04-functions/3-the-callstack/1-the-call-stack.js similarity index 100% rename from 3-functions/3-the-callstack/1-the-call-stack.js rename to 04-functions/3-the-callstack/1-the-call-stack.js diff --git a/3-functions/3-the-callstack/2-callstack-error-messages.js b/04-functions/3-the-callstack/2-callstack-error-messages.js similarity index 100% rename from 3-functions/3-the-callstack/2-callstack-error-messages.js rename to 04-functions/3-the-callstack/2-callstack-error-messages.js diff --git a/3-functions/3-the-callstack/3-console-trace.js b/04-functions/3-the-callstack/3-console-trace.js similarity index 100% rename from 3-functions/3-the-callstack/3-console-trace.js rename to 04-functions/3-the-callstack/3-console-trace.js diff --git a/04-functions/3-the-callstack/study.json b/04-functions/3-the-callstack/study.json new file mode 100644 index 0000000..2c3c986 --- /dev/null +++ b/04-functions/3-the-callstack/study.json @@ -0,0 +1,12 @@ +{ + "study": { + "trace": { + "operators": false, + "console": false, + "controlFlow": false, + "variablesDeclare": false, + "variablesAssign": false, + "variablesRead": false + } + } +} diff --git a/3-functions/4-local-param-parent/examples/0-the-question.js b/04-functions/4-local-param-parent/examples/0-the-question.js similarity index 100% rename from 3-functions/4-local-param-parent/examples/0-the-question.js rename to 04-functions/4-local-param-parent/examples/0-the-question.js diff --git a/3-functions/4-local-param-parent/examples/1-local-variables.js b/04-functions/4-local-param-parent/examples/1-local-variables.js similarity index 100% rename from 3-functions/4-local-param-parent/examples/1-local-variables.js rename to 04-functions/4-local-param-parent/examples/1-local-variables.js diff --git a/3-functions/4-local-param-parent/examples/2-parameters.js b/04-functions/4-local-param-parent/examples/2-parameters.js similarity index 100% rename from 3-functions/4-local-param-parent/examples/2-parameters.js rename to 04-functions/4-local-param-parent/examples/2-parameters.js diff --git a/3-functions/4-local-param-parent/examples/3-parent-scopes.js b/04-functions/4-local-param-parent/examples/3-parent-scopes.js similarity index 100% rename from 3-functions/4-local-param-parent/examples/3-parent-scopes.js rename to 04-functions/4-local-param-parent/examples/3-parent-scopes.js diff --git a/3-functions/4-local-param-parent/examples/4-pure-functions.js b/04-functions/4-local-param-parent/examples/4-pure-functions.js similarity index 100% rename from 3-functions/4-local-param-parent/examples/4-pure-functions.js rename to 04-functions/4-local-param-parent/examples/4-pure-functions.js diff --git a/3-functions/4-local-param-parent/exercises/1-parameter-local.js b/04-functions/4-local-param-parent/exercises/1-parameter-local.js similarity index 100% rename from 3-functions/4-local-param-parent/exercises/1-parameter-local.js rename to 04-functions/4-local-param-parent/exercises/1-parameter-local.js diff --git a/3-functions/4-local-param-parent/exercises/2-parameter-global.js b/04-functions/4-local-param-parent/exercises/2-parameter-global.js similarity index 100% rename from 3-functions/4-local-param-parent/exercises/2-parameter-global.js rename to 04-functions/4-local-param-parent/exercises/2-parameter-global.js diff --git a/3-functions/4-local-param-parent/exercises/3-parameter-global.js b/04-functions/4-local-param-parent/exercises/3-parameter-global.js similarity index 100% rename from 3-functions/4-local-param-parent/exercises/3-parameter-global.js rename to 04-functions/4-local-param-parent/exercises/3-parameter-global.js diff --git a/3-functions/4-local-param-parent/exercises/4-local-global.js b/04-functions/4-local-param-parent/exercises/4-local-global.js similarity index 100% rename from 3-functions/4-local-param-parent/exercises/4-local-global.js rename to 04-functions/4-local-param-parent/exercises/4-local-global.js diff --git a/3-functions/4-local-param-parent/exercises/5-local-global.js b/04-functions/4-local-param-parent/exercises/5-local-global.js similarity index 100% rename from 3-functions/4-local-param-parent/exercises/5-local-global.js rename to 04-functions/4-local-param-parent/exercises/5-local-global.js diff --git a/3-functions/4-local-param-parent/exercises/6-parameter-local-global.js b/04-functions/4-local-param-parent/exercises/6-parameter-local-global.js similarity index 100% rename from 3-functions/4-local-param-parent/exercises/6-parameter-local-global.js rename to 04-functions/4-local-param-parent/exercises/6-parameter-local-global.js diff --git a/3-functions/4-local-param-parent/exercises/7-prameter-local-global.js b/04-functions/4-local-param-parent/exercises/7-prameter-local-global.js similarity index 100% rename from 3-functions/4-local-param-parent/exercises/7-prameter-local-global.js rename to 04-functions/4-local-param-parent/exercises/7-prameter-local-global.js diff --git a/04-functions/README.md b/04-functions/README.md new file mode 100644 index 0000000..6272c4f --- /dev/null +++ b/04-functions/README.md @@ -0,0 +1,40 @@ +# Functions + +This chapter (and the rest of the module) will focus on ES6 Arrow Functions +assigned to constant variables. There are a few reasons for this: + +- The syntax of assigning a function to a variable makes it clear from the + beginning that functions are just values, which is helpful for understanding + callbacks later on. `function name() {}` syntax can make this less obvious. +- Using a constant variable means you cannot accidentally assign a different + value to the variable that stores your function. There's a whole type of bug + you don't need to worry about! +- Having one way to declare a function makes it easier to focus on the basics. + Using `function` functions opens the door to many ways of declaring a + function: _named declarations_, _anonymous function expressions_, _named + function expressions_. +- _Function Hoisting_ is a possibly confusing behavior that can distract from + focusing on how functions work, and how to use them in a program. Arrow + functions assigned to constant variables are not hoisted, so no worries there! + You can learn about this later. + +## 1. Functions + +Learn how to read, visualize, trace, test and debug functions in JavaScript. + +## 2. Documenting Functions + +Learn how to use default parameters and the JSDoc convention to clearly describe +a function for other developers: its _arguments_, _return value_ and _behavior_. + +## 3. The Callstack + +Study a few examples and practice using your browser's devtools to look inside +the JavaScript _execution environment_ and understand how nested function calls +create a _callstack_. + +## 4. Local, Param, Parent + +Build on what you learned in **The Callstack** to understand 3 _scoping_ +mechanisms that can be used inside a function to assign values to your +variables. diff --git a/04-functions/study.json b/04-functions/study.json new file mode 100644 index 0000000..b666c63 --- /dev/null +++ b/04-functions/study.json @@ -0,0 +1,6 @@ +{ + "study": { + "openIn": "jsTutorLive", + "ask": false + } +} diff --git a/05-unit-testing/README.md b/05-unit-testing/README.md new file mode 100644 index 0000000..4f93f3e --- /dev/null +++ b/05-unit-testing/README.md @@ -0,0 +1,19 @@ +# Unit Testing + +Learn how to read, write and run unit tests to describe and verify your +functions' behavior. You will focus on the _Behavior-Driven Development_ +convention of using `describe`, `it`, and `expect(__).toEqual(__)`. + +Exercises include writing tests for a working function, and writing functions to +pass a given test suite. + +--- + +## Running Tests in VSCode + +> [guide video](https://vimeo.com713215049) + +If you want to, you can run all of the tests in this repo using this NPM script: + +- `npm run test -- ./path/to/file.test.js` Check out the guides in this folder + to learn more about using the VSCode debugger. diff --git a/4-unit-testing/examples/0-running-tested-code.test.js b/05-unit-testing/examples/0-running-tested-code.test.js similarity index 100% rename from 4-unit-testing/examples/0-running-tested-code.test.js rename to 05-unit-testing/examples/0-running-tested-code.test.js diff --git a/4-unit-testing/examples/1-describe.test.js b/05-unit-testing/examples/1-describe.test.js similarity index 100% rename from 4-unit-testing/examples/1-describe.test.js rename to 05-unit-testing/examples/1-describe.test.js diff --git a/4-unit-testing/examples/2-it.test.js b/05-unit-testing/examples/2-it.test.js similarity index 100% rename from 4-unit-testing/examples/2-it.test.js rename to 05-unit-testing/examples/2-it.test.js diff --git a/4-unit-testing/examples/3-expect.test.js b/05-unit-testing/examples/3-expect.test.js similarity index 100% rename from 4-unit-testing/examples/3-expect.test.js rename to 05-unit-testing/examples/3-expect.test.js diff --git a/4-unit-testing/examples/4-testing-functions.test.js b/05-unit-testing/examples/4-testing-functions.test.js similarity index 100% rename from 4-unit-testing/examples/4-testing-functions.test.js rename to 05-unit-testing/examples/4-testing-functions.test.js diff --git a/4-unit-testing/examples/5-fixing-bugs.test.js b/05-unit-testing/examples/5-fixing-bugs.test.js similarity index 100% rename from 4-unit-testing/examples/5-fixing-bugs.test.js rename to 05-unit-testing/examples/5-fixing-bugs.test.js diff --git a/4-unit-testing/examples/6-red-green-refactor.test.js b/05-unit-testing/examples/6-red-green-refactor.test.js similarity index 100% rename from 4-unit-testing/examples/6-red-green-refactor.test.js rename to 05-unit-testing/examples/6-red-green-refactor.test.js diff --git a/4-unit-testing/exercises/1-write-tests/add.test.js b/05-unit-testing/exercises/1-write-tests/add.test.js similarity index 100% rename from 4-unit-testing/exercises/1-write-tests/add.test.js rename to 05-unit-testing/exercises/1-write-tests/add.test.js diff --git a/4-unit-testing/exercises/1-write-tests/roller-coastering-permission.test.js b/05-unit-testing/exercises/1-write-tests/roller-coastering-permission.test.js similarity index 100% rename from 4-unit-testing/exercises/1-write-tests/roller-coastering-permission.test.js rename to 05-unit-testing/exercises/1-write-tests/roller-coastering-permission.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/1-blanks/count-character.test.js b/05-unit-testing/exercises/2-pass-tests/1-blanks/count-character.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/1-blanks/count-character.test.js rename to 05-unit-testing/exercises/2-pass-tests/1-blanks/count-character.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/1-blanks/is-palindrome.test.js b/05-unit-testing/exercises/2-pass-tests/1-blanks/is-palindrome.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/1-blanks/is-palindrome.test.js rename to 05-unit-testing/exercises/2-pass-tests/1-blanks/is-palindrome.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/1-blanks/skip-characters.test.js b/05-unit-testing/exercises/2-pass-tests/1-blanks/skip-characters.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/1-blanks/skip-characters.test.js rename to 05-unit-testing/exercises/2-pass-tests/1-blanks/skip-characters.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/1-blanks/sum-of-digits.test.js b/05-unit-testing/exercises/2-pass-tests/1-blanks/sum-of-digits.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/1-blanks/sum-of-digits.test.js rename to 05-unit-testing/exercises/2-pass-tests/1-blanks/sum-of-digits.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/2-bugs/count-character.test.js b/05-unit-testing/exercises/2-pass-tests/2-bugs/count-character.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/2-bugs/count-character.test.js rename to 05-unit-testing/exercises/2-pass-tests/2-bugs/count-character.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/2-bugs/is-palindrome.test.js b/05-unit-testing/exercises/2-pass-tests/2-bugs/is-palindrome.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/2-bugs/is-palindrome.test.js rename to 05-unit-testing/exercises/2-pass-tests/2-bugs/is-palindrome.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/2-bugs/skip-characters.test.js b/05-unit-testing/exercises/2-pass-tests/2-bugs/skip-characters.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/2-bugs/skip-characters.test.js rename to 05-unit-testing/exercises/2-pass-tests/2-bugs/skip-characters.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/2-bugs/sum-of-digits.test.js b/05-unit-testing/exercises/2-pass-tests/2-bugs/sum-of-digits.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/2-bugs/sum-of-digits.test.js rename to 05-unit-testing/exercises/2-pass-tests/2-bugs/sum-of-digits.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/3-empty/1-addition.test.js b/05-unit-testing/exercises/2-pass-tests/3-empty/1-addition.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/3-empty/1-addition.test.js rename to 05-unit-testing/exercises/2-pass-tests/3-empty/1-addition.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/3-empty/2-repeater.test.js b/05-unit-testing/exercises/2-pass-tests/3-empty/2-repeater.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/3-empty/2-repeater.test.js rename to 05-unit-testing/exercises/2-pass-tests/3-empty/2-repeater.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/3-empty/3-reverser.test.js b/05-unit-testing/exercises/2-pass-tests/3-empty/3-reverser.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/3-empty/3-reverser.test.js rename to 05-unit-testing/exercises/2-pass-tests/3-empty/3-reverser.test.js diff --git a/4-unit-testing/exercises/2-pass-tests/3-empty/4-index-of.test.js b/05-unit-testing/exercises/2-pass-tests/3-empty/4-index-of.test.js similarity index 100% rename from 4-unit-testing/exercises/2-pass-tests/3-empty/4-index-of.test.js rename to 05-unit-testing/exercises/2-pass-tests/3-empty/4-index-of.test.js diff --git a/06-es-modules/.eslintrc.json b/06-es-modules/.eslintrc.json new file mode 100644 index 0000000..ad8dbb3 --- /dev/null +++ b/06-es-modules/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "parserOptions": { + "sourceType": "module" + } +} diff --git a/5-es-modules/1-import-and-export/examples/0-creation-and-execution/index.js b/06-es-modules/1-import-and-export/examples/0-creation-and-execution/index.js similarity index 100% rename from 5-es-modules/1-import-and-export/examples/0-creation-and-execution/index.js rename to 06-es-modules/1-import-and-export/examples/0-creation-and-execution/index.js diff --git a/5-es-modules/1-import-and-export/examples/0-creation-and-execution/user.js b/06-es-modules/1-import-and-export/examples/0-creation-and-execution/user.js similarity index 100% rename from 5-es-modules/1-import-and-export/examples/0-creation-and-execution/user.js rename to 06-es-modules/1-import-and-export/examples/0-creation-and-execution/user.js diff --git a/5-es-modules/1-import-and-export/examples/1-primitives/index.js b/06-es-modules/1-import-and-export/examples/1-primitives/index.js similarity index 100% rename from 5-es-modules/1-import-and-export/examples/1-primitives/index.js rename to 06-es-modules/1-import-and-export/examples/1-primitives/index.js diff --git a/5-es-modules/1-import-and-export/examples/1-primitives/user.js b/06-es-modules/1-import-and-export/examples/1-primitives/user.js similarity index 100% rename from 5-es-modules/1-import-and-export/examples/1-primitives/user.js rename to 06-es-modules/1-import-and-export/examples/1-primitives/user.js diff --git a/5-es-modules/1-import-and-export/examples/2-functions/greet.js b/06-es-modules/1-import-and-export/examples/2-functions/greet.js similarity index 100% rename from 5-es-modules/1-import-and-export/examples/2-functions/greet.js rename to 06-es-modules/1-import-and-export/examples/2-functions/greet.js diff --git a/5-es-modules/1-import-and-export/examples/2-functions/index.js b/06-es-modules/1-import-and-export/examples/2-functions/index.js similarity index 100% rename from 5-es-modules/1-import-and-export/examples/2-functions/index.js rename to 06-es-modules/1-import-and-export/examples/2-functions/index.js diff --git a/5-es-modules/1-import-and-export/examples/README.md b/06-es-modules/1-import-and-export/examples/README.md similarity index 100% rename from 5-es-modules/1-import-and-export/examples/README.md rename to 06-es-modules/1-import-and-export/examples/README.md diff --git a/5-es-modules/1-import-and-export/exercises/exercise-01/index.js b/06-es-modules/1-import-and-export/exercises/exercise-01/index.js similarity index 100% rename from 5-es-modules/1-import-and-export/exercises/exercise-01/index.js rename to 06-es-modules/1-import-and-export/exercises/exercise-01/index.js diff --git a/5-es-modules/1-import-and-export/exercises/exercise-01/user.js b/06-es-modules/1-import-and-export/exercises/exercise-01/user.js similarity index 100% rename from 5-es-modules/1-import-and-export/exercises/exercise-01/user.js rename to 06-es-modules/1-import-and-export/exercises/exercise-01/user.js diff --git a/5-es-modules/1-import-and-export/exercises/exercise-02/index.js b/06-es-modules/1-import-and-export/exercises/exercise-02/index.js similarity index 100% rename from 5-es-modules/1-import-and-export/exercises/exercise-02/index.js rename to 06-es-modules/1-import-and-export/exercises/exercise-02/index.js diff --git a/5-es-modules/1-import-and-export/exercises/exercise-02/user.js b/06-es-modules/1-import-and-export/exercises/exercise-02/user.js similarity index 100% rename from 5-es-modules/1-import-and-export/exercises/exercise-02/user.js rename to 06-es-modules/1-import-and-export/exercises/exercise-02/user.js diff --git a/5-es-modules/1-import-and-export/exercises/exercise-03/index.js b/06-es-modules/1-import-and-export/exercises/exercise-03/index.js similarity index 100% rename from 5-es-modules/1-import-and-export/exercises/exercise-03/index.js rename to 06-es-modules/1-import-and-export/exercises/exercise-03/index.js diff --git a/5-es-modules/1-import-and-export/exercises/exercise-03/reverse.js b/06-es-modules/1-import-and-export/exercises/exercise-03/reverse.js similarity index 100% rename from 5-es-modules/1-import-and-export/exercises/exercise-03/reverse.js rename to 06-es-modules/1-import-and-export/exercises/exercise-03/reverse.js diff --git a/5-es-modules/1-import-and-export/exercises/exercise-04/index.js b/06-es-modules/1-import-and-export/exercises/exercise-04/index.js similarity index 100% rename from 5-es-modules/1-import-and-export/exercises/exercise-04/index.js rename to 06-es-modules/1-import-and-export/exercises/exercise-04/index.js diff --git a/5-es-modules/1-import-and-export/exercises/exercise-04/say-hi.js b/06-es-modules/1-import-and-export/exercises/exercise-04/say-hi.js similarity index 100% rename from 5-es-modules/1-import-and-export/exercises/exercise-04/say-hi.js rename to 06-es-modules/1-import-and-export/exercises/exercise-04/say-hi.js diff --git a/5-es-modules/2-spec-files/examples/is-palindrome.js b/06-es-modules/2-spec-files/examples/is-palindrome.js similarity index 100% rename from 5-es-modules/2-spec-files/examples/is-palindrome.js rename to 06-es-modules/2-spec-files/examples/is-palindrome.js diff --git a/5-es-modules/2-spec-files/examples/is-palindrome.spec.js b/06-es-modules/2-spec-files/examples/is-palindrome.spec.js similarity index 100% rename from 5-es-modules/2-spec-files/examples/is-palindrome.spec.js rename to 06-es-modules/2-spec-files/examples/is-palindrome.spec.js diff --git a/5-es-modules/2-spec-files/exercises/1-refactor/count-character.js b/06-es-modules/2-spec-files/exercises/1-refactor/count-character.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/1-refactor/count-character.js rename to 06-es-modules/2-spec-files/exercises/1-refactor/count-character.js diff --git a/5-es-modules/2-spec-files/exercises/1-refactor/count-character.spec.js b/06-es-modules/2-spec-files/exercises/1-refactor/count-character.spec.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/1-refactor/count-character.spec.js rename to 06-es-modules/2-spec-files/exercises/1-refactor/count-character.spec.js diff --git a/5-es-modules/2-spec-files/exercises/1-refactor/repeat-string.js b/06-es-modules/2-spec-files/exercises/1-refactor/repeat-string.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/1-refactor/repeat-string.js rename to 06-es-modules/2-spec-files/exercises/1-refactor/repeat-string.js diff --git a/5-es-modules/2-spec-files/exercises/1-refactor/repeat-string.spec.js b/06-es-modules/2-spec-files/exercises/1-refactor/repeat-string.spec.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/1-refactor/repeat-string.spec.js rename to 06-es-modules/2-spec-files/exercises/1-refactor/repeat-string.spec.js diff --git a/5-es-modules/2-spec-files/exercises/2-write-tests/file-to-variable.js b/06-es-modules/2-spec-files/exercises/2-write-tests/file-to-variable.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/2-write-tests/file-to-variable.js rename to 06-es-modules/2-spec-files/exercises/2-write-tests/file-to-variable.js diff --git a/5-es-modules/2-spec-files/exercises/2-write-tests/file-to-variable.spec.js b/06-es-modules/2-spec-files/exercises/2-write-tests/file-to-variable.spec.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/2-write-tests/file-to-variable.spec.js rename to 06-es-modules/2-spec-files/exercises/2-write-tests/file-to-variable.spec.js diff --git a/5-es-modules/2-spec-files/exercises/2-write-tests/reverse-a-string.js b/06-es-modules/2-spec-files/exercises/2-write-tests/reverse-a-string.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/2-write-tests/reverse-a-string.js rename to 06-es-modules/2-spec-files/exercises/2-write-tests/reverse-a-string.js diff --git a/5-es-modules/2-spec-files/exercises/2-write-tests/reverse-a-string.spec.js b/06-es-modules/2-spec-files/exercises/2-write-tests/reverse-a-string.spec.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/2-write-tests/reverse-a-string.spec.js rename to 06-es-modules/2-spec-files/exercises/2-write-tests/reverse-a-string.spec.js diff --git a/5-es-modules/2-spec-files/exercises/3-pass-tests/similarity.js b/06-es-modules/2-spec-files/exercises/3-pass-tests/similarity.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/3-pass-tests/similarity.js rename to 06-es-modules/2-spec-files/exercises/3-pass-tests/similarity.js diff --git a/5-es-modules/2-spec-files/exercises/3-pass-tests/similarity.spec.js b/06-es-modules/2-spec-files/exercises/3-pass-tests/similarity.spec.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/3-pass-tests/similarity.spec.js rename to 06-es-modules/2-spec-files/exercises/3-pass-tests/similarity.spec.js diff --git a/5-es-modules/2-spec-files/exercises/3-pass-tests/type-of-value.js b/06-es-modules/2-spec-files/exercises/3-pass-tests/type-of-value.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/3-pass-tests/type-of-value.js rename to 06-es-modules/2-spec-files/exercises/3-pass-tests/type-of-value.js diff --git a/5-es-modules/2-spec-files/exercises/3-pass-tests/type-of-value.spec.js b/06-es-modules/2-spec-files/exercises/3-pass-tests/type-of-value.spec.js similarity index 100% rename from 5-es-modules/2-spec-files/exercises/3-pass-tests/type-of-value.spec.js rename to 06-es-modules/2-spec-files/exercises/3-pass-tests/type-of-value.spec.js diff --git a/06-es-modules/README.md b/06-es-modules/README.md new file mode 100644 index 0000000..44503f1 --- /dev/null +++ b/06-es-modules/README.md @@ -0,0 +1,28 @@ +# ES Modules + +In this chapter you will learn one way to _export_ variables from one file, and +_import_ them to another. + +ES Modules are a complex language feature with many syntax variations and +different usage conventions. We will focus on only one reliable and simple +approach so you can focus on your program's logic and structure. You will learn +how to: + +- `export const name = __;` Export a constant variable from a JS file. +- `import { name } from '
+ + + +
+ +your output: + + +
+ +expected output: + +;` Import a constant variable into a file by + name. + +## 1. Import and Export + +Practice reading, asserting and writing simple programs that export and import +values. + +## 2. Spec Files + +Learn how to use ES Modules to separate your functions and unit tests into two +separate files. Exercises include: + +- _Refactoring_ functions and unit tests from one file to two files. +- Writing unit tests in one file to describe a function declared in a different + file. +- Writing a function in one file to pass unit tests in a separate file. diff --git a/06-es-modules/study.json b/06-es-modules/study.json new file mode 100644 index 0000000..9963fd7 --- /dev/null +++ b/06-es-modules/study.json @@ -0,0 +1,11 @@ +{ + "study": { + "type": "module", + "environment": true, + "flowchart": false, + "variables": false, + "loopGuard": false, + "ask": false, + "trace": false + } +} diff --git a/6-using-functions/1-calling-functions/examples/reverse-input.js b/07-using-functions/1-calling-functions/examples/reverse-input.js similarity index 100% rename from 6-using-functions/1-calling-functions/examples/reverse-input.js rename to 07-using-functions/1-calling-functions/examples/reverse-input.js diff --git a/6-using-functions/1-calling-functions/examples/reverse-things.js b/07-using-functions/1-calling-functions/examples/reverse-things.js similarity index 100% rename from 6-using-functions/1-calling-functions/examples/reverse-things.js rename to 07-using-functions/1-calling-functions/examples/reverse-things.js diff --git a/6-using-functions/1-calling-functions/examples/utils/reverse.js b/07-using-functions/1-calling-functions/examples/utils/reverse.js similarity index 100% rename from 6-using-functions/1-calling-functions/examples/utils/reverse.js rename to 07-using-functions/1-calling-functions/examples/utils/reverse.js diff --git a/6-using-functions/1-calling-functions/examples/utils/reverse.spec.js b/07-using-functions/1-calling-functions/examples/utils/reverse.spec.js similarity index 100% rename from 6-using-functions/1-calling-functions/examples/utils/reverse.spec.js rename to 07-using-functions/1-calling-functions/examples/utils/reverse.spec.js diff --git a/6-using-functions/1-calling-functions/exercises/remove-these.js b/07-using-functions/1-calling-functions/exercises/remove-these.js similarity index 100% rename from 6-using-functions/1-calling-functions/exercises/remove-these.js rename to 07-using-functions/1-calling-functions/exercises/remove-these.js diff --git a/6-using-functions/1-calling-functions/exercises/utils/remove-characters.js b/07-using-functions/1-calling-functions/exercises/utils/remove-characters.js similarity index 100% rename from 6-using-functions/1-calling-functions/exercises/utils/remove-characters.js rename to 07-using-functions/1-calling-functions/exercises/utils/remove-characters.js diff --git a/6-using-functions/1-calling-functions/exercises/utils/remove-characters.spec.js b/07-using-functions/1-calling-functions/exercises/utils/remove-characters.spec.js similarity index 100% rename from 6-using-functions/1-calling-functions/exercises/utils/remove-characters.spec.js rename to 07-using-functions/1-calling-functions/exercises/utils/remove-characters.spec.js diff --git a/6-using-functions/1-calling-functions/exercises/vowels-or-consonants-conditional.js b/07-using-functions/1-calling-functions/exercises/vowels-or-consonants-conditional.js similarity index 100% rename from 6-using-functions/1-calling-functions/exercises/vowels-or-consonants-conditional.js rename to 07-using-functions/1-calling-functions/exercises/vowels-or-consonants-conditional.js diff --git a/6-using-functions/1-calling-functions/exercises/vowels-or-consonants-ternary.js b/07-using-functions/1-calling-functions/exercises/vowels-or-consonants-ternary.js similarity index 100% rename from 6-using-functions/1-calling-functions/exercises/vowels-or-consonants-ternary.js rename to 07-using-functions/1-calling-functions/exercises/vowels-or-consonants-ternary.js diff --git a/6-using-functions/2-writing-functions/exercises/keep-or-repeat.js b/07-using-functions/2-writing-functions/exercises/keep-or-repeat.js similarity index 100% rename from 6-using-functions/2-writing-functions/exercises/keep-or-repeat.js rename to 07-using-functions/2-writing-functions/exercises/keep-or-repeat.js diff --git a/6-using-functions/2-writing-functions/exercises/repeat-characters.js b/07-using-functions/2-writing-functions/exercises/repeat-characters.js similarity index 100% rename from 6-using-functions/2-writing-functions/exercises/repeat-characters.js rename to 07-using-functions/2-writing-functions/exercises/repeat-characters.js diff --git a/6-using-functions/2-writing-functions/exercises/utils/keep-characters.js b/07-using-functions/2-writing-functions/exercises/utils/keep-characters.js similarity index 100% rename from 6-using-functions/2-writing-functions/exercises/utils/keep-characters.js rename to 07-using-functions/2-writing-functions/exercises/utils/keep-characters.js diff --git a/6-using-functions/2-writing-functions/exercises/utils/keep-characters.spec.js b/07-using-functions/2-writing-functions/exercises/utils/keep-characters.spec.js similarity index 100% rename from 6-using-functions/2-writing-functions/exercises/utils/keep-characters.spec.js rename to 07-using-functions/2-writing-functions/exercises/utils/keep-characters.spec.js diff --git a/6-using-functions/2-writing-functions/exercises/utils/repeat-characters.js b/07-using-functions/2-writing-functions/exercises/utils/repeat-characters.js similarity index 100% rename from 6-using-functions/2-writing-functions/exercises/utils/repeat-characters.js rename to 07-using-functions/2-writing-functions/exercises/utils/repeat-characters.js diff --git a/6-using-functions/2-writing-functions/exercises/utils/repeat-characters.spec.js b/07-using-functions/2-writing-functions/exercises/utils/repeat-characters.spec.js similarity index 100% rename from 6-using-functions/2-writing-functions/exercises/utils/repeat-characters.spec.js rename to 07-using-functions/2-writing-functions/exercises/utils/repeat-characters.spec.js diff --git a/6-using-functions/3-refactoring-functions/README.md b/07-using-functions/3-refactoring-functions/README.md similarity index 100% rename from 6-using-functions/3-refactoring-functions/README.md rename to 07-using-functions/3-refactoring-functions/README.md diff --git a/6-using-functions/3-refactoring-functions/exercises/reverse-word-or-phrase.js b/07-using-functions/3-refactoring-functions/exercises/reverse-word-or-phrase.js similarity index 100% rename from 6-using-functions/3-refactoring-functions/exercises/reverse-word-or-phrase.js rename to 07-using-functions/3-refactoring-functions/exercises/reverse-word-or-phrase.js diff --git a/6-using-functions/3-refactoring-functions/exercises/unicode-shuffle.js b/07-using-functions/3-refactoring-functions/exercises/unicode-shuffle.js similarity index 100% rename from 6-using-functions/3-refactoring-functions/exercises/unicode-shuffle.js rename to 07-using-functions/3-refactoring-functions/exercises/unicode-shuffle.js diff --git a/6-using-functions/3-refactoring-functions/exercises/utils/filter.js b/07-using-functions/3-refactoring-functions/exercises/utils/filter.js similarity index 100% rename from 6-using-functions/3-refactoring-functions/exercises/utils/filter.js rename to 07-using-functions/3-refactoring-functions/exercises/utils/filter.js diff --git a/6-using-functions/3-refactoring-functions/exercises/utils/filter.spec.js b/07-using-functions/3-refactoring-functions/exercises/utils/filter.spec.js similarity index 100% rename from 6-using-functions/3-refactoring-functions/exercises/utils/filter.spec.js rename to 07-using-functions/3-refactoring-functions/exercises/utils/filter.spec.js diff --git a/6-using-functions/3-refactoring-functions/exercises/utils/reverse.js b/07-using-functions/3-refactoring-functions/exercises/utils/reverse.js similarity index 100% rename from 6-using-functions/3-refactoring-functions/exercises/utils/reverse.js rename to 07-using-functions/3-refactoring-functions/exercises/utils/reverse.js diff --git a/6-using-functions/3-refactoring-functions/exercises/utils/reverse.spec.js b/07-using-functions/3-refactoring-functions/exercises/utils/reverse.spec.js similarity index 100% rename from 6-using-functions/3-refactoring-functions/exercises/utils/reverse.spec.js rename to 07-using-functions/3-refactoring-functions/exercises/utils/reverse.spec.js diff --git a/6-using-functions/3-refactoring-functions/exercises/utils/shift-characters.js b/07-using-functions/3-refactoring-functions/exercises/utils/shift-characters.js similarity index 100% rename from 6-using-functions/3-refactoring-functions/exercises/utils/shift-characters.js rename to 07-using-functions/3-refactoring-functions/exercises/utils/shift-characters.js diff --git a/6-using-functions/3-refactoring-functions/exercises/utils/shift-characters.spec.js b/07-using-functions/3-refactoring-functions/exercises/utils/shift-characters.spec.js similarity index 100% rename from 6-using-functions/3-refactoring-functions/exercises/utils/shift-characters.spec.js rename to 07-using-functions/3-refactoring-functions/exercises/utils/shift-characters.spec.js diff --git a/6-using-functions/3-refactoring-functions/exercises/vowels-or-consonants.js b/07-using-functions/3-refactoring-functions/exercises/vowels-or-consonants.js similarity index 100% rename from 6-using-functions/3-refactoring-functions/exercises/vowels-or-consonants.js rename to 07-using-functions/3-refactoring-functions/exercises/vowels-or-consonants.js diff --git a/6-using-functions/4-reverse-engineering/README.md b/07-using-functions/4-reverse-engineering/README.md similarity index 100% rename from 6-using-functions/4-reverse-engineering/README.md rename to 07-using-functions/4-reverse-engineering/README.md diff --git a/6-using-functions/4-reverse-engineering/exercises/remove-duplicates.js b/07-using-functions/4-reverse-engineering/exercises/remove-duplicates.js similarity index 100% rename from 6-using-functions/4-reverse-engineering/exercises/remove-duplicates.js rename to 07-using-functions/4-reverse-engineering/exercises/remove-duplicates.js diff --git a/6-using-functions/4-reverse-engineering/exercises/remove-duplicates.re.js b/07-using-functions/4-reverse-engineering/exercises/remove-duplicates.re.js similarity index 100% rename from 6-using-functions/4-reverse-engineering/exercises/remove-duplicates.re.js rename to 07-using-functions/4-reverse-engineering/exercises/remove-duplicates.re.js diff --git a/6-using-functions/4-reverse-engineering/exercises/repeat-or-remove.js b/07-using-functions/4-reverse-engineering/exercises/repeat-or-remove.js similarity index 100% rename from 6-using-functions/4-reverse-engineering/exercises/repeat-or-remove.js rename to 07-using-functions/4-reverse-engineering/exercises/repeat-or-remove.js diff --git a/6-using-functions/4-reverse-engineering/exercises/repeat-or-remove.re.js b/07-using-functions/4-reverse-engineering/exercises/repeat-or-remove.re.js similarity index 100% rename from 6-using-functions/4-reverse-engineering/exercises/repeat-or-remove.re.js rename to 07-using-functions/4-reverse-engineering/exercises/repeat-or-remove.re.js diff --git a/6-using-functions/4-reverse-engineering/exercises/replace.js b/07-using-functions/4-reverse-engineering/exercises/replace.js similarity index 100% rename from 6-using-functions/4-reverse-engineering/exercises/replace.js rename to 07-using-functions/4-reverse-engineering/exercises/replace.js diff --git a/6-using-functions/4-reverse-engineering/exercises/replace.re.js b/07-using-functions/4-reverse-engineering/exercises/replace.re.js similarity index 100% rename from 6-using-functions/4-reverse-engineering/exercises/replace.re.js rename to 07-using-functions/4-reverse-engineering/exercises/replace.re.js diff --git a/6-using-functions/4-reverse-engineering/exercises/search.js b/07-using-functions/4-reverse-engineering/exercises/search.js similarity index 100% rename from 6-using-functions/4-reverse-engineering/exercises/search.js rename to 07-using-functions/4-reverse-engineering/exercises/search.js diff --git a/6-using-functions/4-reverse-engineering/exercises/search.re.js b/07-using-functions/4-reverse-engineering/exercises/search.re.js similarity index 100% rename from 6-using-functions/4-reverse-engineering/exercises/search.re.js rename to 07-using-functions/4-reverse-engineering/exercises/search.re.js diff --git a/6-using-functions/4-reverse-engineering/exercises/utils/README.md b/07-using-functions/4-reverse-engineering/exercises/utils/README.md similarity index 100% rename from 6-using-functions/4-reverse-engineering/exercises/utils/README.md rename to 07-using-functions/4-reverse-engineering/exercises/utils/README.md diff --git a/6-using-functions/5-dom-io/README.md b/07-using-functions/5-dom-ui/README.md similarity index 100% rename from 6-using-functions/5-dom-io/README.md rename to 07-using-functions/5-dom-ui/README.md diff --git a/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/index.html b/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/index.html new file mode 100644 index 0000000..15073bf --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/index.html @@ -0,0 +1,26 @@ + + + + + + cat advice + + + + + ++ i like cats: + + + + diff --git a/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/src/give-advice.js b/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/src/give-advice.js new file mode 100644 index 0000000..3c8b0ed --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/src/give-advice.js @@ -0,0 +1,27 @@ +import { _ } from './_/_.js'; + +// once when the script is loaded +debugger; + +// declare the function to call each time a user clicks +const giveAdvice = () => { + // each time the user interacts + debugger; + + // read the user's boolean input from the UI + + const likesCats = _; + const isAllergic = _; + const ownsOne = _; + + // generate good advice + + const advice = _(_, _, _); + + // share your advice with the user + + _._(_)._ = _; +}; + +// attach the event listener to call the function each time the user clicks +document.getElementById('give-advice').addEventListener('click', giveAdvice); diff --git a/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/src/utils/cat-advisor.js b/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/src/utils/cat-advisor.js new file mode 100644 index 0000000..f5ea9c4 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/src/utils/cat-advisor.js @@ -0,0 +1,8 @@ +/** + * + * @param {boolean} likesCats + * @param {boolean} isAllergic + * @param {boolean} ownsOne + * @returns {boolean} + */ +export const catAdvisor = (likesCats, isAllergic, ownsOne) => {}; diff --git a/lesson-plans/group-project-intro/examples/cat-advice/src/utils/cat-advisor.spec.js b/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/src/utils/cat-advisor.spec.js similarity index 100% rename from lesson-plans/group-project-intro/examples/cat-advice/src/utils/cat-advisor.spec.js rename to 07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/src/utils/cat-advisor.spec.js diff --git a/lesson-plans/for-loops/2-integrate/multiplication/styles.css b/07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/styles.css similarity index 100% rename from lesson-plans/for-loops/2-integrate/multiplication/styles.css rename to 07-using-functions/5-dom-ui/exercises/1-blanks/cat-advice/styles.css diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/index.html b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/index.html new file mode 100644 index 0000000..b3f876f --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/index.html @@ -0,0 +1,33 @@ + + + + + +
+ i am allergic to cats:
+ i own a cat:
+ + + +
+ + +multiplication + + + + + ++ + X + + + + + + diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/script.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/script.js new file mode 100644 index 0000000..09a1133 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/script.js @@ -0,0 +1,19 @@ +import { _ } from './utils/_.js'; + +/* Repeat Characters + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- define handler function --- + +const __ = () => {}; + +// --- pass callback to event listener --- + +_.addEventListener('click', __); diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/script.re.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/script.re.js new file mode 100644 index 0000000..a263844 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/script.re.js @@ -0,0 +1,87 @@ +const _0x5bc63e = _0x8797; +!(function (n, t) { + const r = _0x8797, + e = _0x3417(); + for (;;) + try { + if ( + 242312 === + (-parseInt(r(319)) / 1) * (-parseInt(r(316)) / 2) + + (-parseInt(r(333)) / 3) * (-parseInt(r(322)) / 4) + + (parseInt(r(337)) / 5) * (-parseInt(r(321)) / 6) + + parseInt(r(335)) / 7 + + (-parseInt(r(328)) / 8) * (-parseInt(r(327)) / 9) + + parseInt(r(315)) / 10 + + -parseInt(r(318)) / 11 + ) + break; + e.push(e.shift()); + } catch (n) { + e.push(e.shift()); + } +})(); +import { + whenButtonIsClicked, + readNumber, + displayString, +} from '../../../lib/dom-io/index.js'; +function _0x3417() { + const n = [ + 'do-math', + '9466677RHcSje', + '250971TfyEvf', + 'eEnPF', + '2591106arJelo', + '8GgWMPf', + 'left', + 'nCNYr', + 'right', + 'uduVI', + '5013AqASTR', + '4376NJtayd', + 'secret-solution', + 'qOUaD', + 'fgNQQ', + 'RFsIl', + '442164hzziHS', + 'a * b -> ', + '2971997EvuWhk', + 'mUZvO', + '5ESrgHz', + '2597730VmQakJ', + '2kDCaiy', + ]; + return (_0x3417 = function () { + return n; + })(); +} +function _0x8797(n, t) { + const r = _0x3417(); + return (_0x8797 = function (n, t) { + return r[(n -= 315)]; + })(n, t); +} +whenButtonIsClicked(_0x5bc63e(317), () => { + const n = _0x5bc63e, + t = { + nCNYr: function (n, t) { + return n(t); + }, + fgNQQ: n(323), + mUZvO: function (n, t) { + return n(t); + }, + qOUaD: n(325), + RFsIl: function (n, t) { + return n * t; + }, + uduVI: function (n, t, r) { + return n(t, r); + }, + eEnPF: n(329), + }, + r = t[n(324)](readNumber, t[n(331)]), + e = t[n(336)](readNumber, t[n(330)]), + u = n(334) + t[n(332)](r, e); + t[n(326)](displayString, t[n(320)], u); +}); diff --git a/lesson-plans/for-loops/2-integrate/repeat-characters/styles.css b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/styles.css similarity index 100% rename from lesson-plans/for-loops/2-integrate/repeat-characters/styles.css rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/styles.css diff --git a/6-using-functions/5-dom-io/multiplication/utils/README.md b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/utils/README.md similarity index 100% rename from 6-using-functions/5-dom-io/multiplication/utils/README.md rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/multiplication/utils/README.md diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/index.html b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/index.html new file mode 100644 index 0000000..93fb8b6 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/index.html @@ -0,0 +1,34 @@ + + + + + +
+ + + +
+ +your output: + + +
+ +expected output: + +repeat characters + + + + + ++ repeat each character in this string: + + + + + + diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/script.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/script.js new file mode 100644 index 0000000..09a1133 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/script.js @@ -0,0 +1,19 @@ +import { _ } from './utils/_.js'; + +/* Repeat Characters + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- define handler function --- + +const __ = () => {}; + +// --- pass callback to event listener --- + +_.addEventListener('click', __); diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/script.re.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/script.re.js new file mode 100644 index 0000000..4b01abd --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/script.re.js @@ -0,0 +1,91 @@ +const _0x193672 = _0x4c8f; +function _0x1ff9() { + const n = [ + 'ution', + 'user-text', + 'nXfYs', + 'number-of-', + '2891125hrcMGY', + '54750dkmJEI', + '2658bGNGqb', + 'nOrWu', + '2513104dtnpFq', + 'FxzRG', + '792UnsBli', + '70CNLfpu', + 'secret-sol', + 'repeat-the', + '100FZNoZp', + 'fntcZ', + '52030IDjDRe', + 'entPl', + '10CNHWJj', + '1134711puhxwJ', + 'bhlNo', + '7Pivqqw', + 'kmWxk', + '2947962nwyaFk', + 'times', + ]; + return (_0x1ff9 = function () { + return n; + })(); +} +function _0x4c8f(n, t) { + const r = _0x1ff9(); + return (_0x4c8f = function (n, t) { + return r[(n -= 426)]; + })(n, t); +} +!(function (n, t) { + const r = _0x4c8f, + e = _0x1ff9(); + for (;;) + try { + if ( + 338261 === + (parseInt(r(445)) / 1) * (parseInt(r(440)) / 2) + + (-parseInt(r(439)) / 3) * (-parseInt(r(448)) / 4) + + -parseInt(r(438)) / 5 + + (parseInt(r(432)) / 6) * (parseInt(r(430)) / 7) + + parseInt(r(442)) / 8 + + (parseInt(r(428)) / 9) * (-parseInt(r(427)) / 10) + + (parseInt(r(450)) / 11) * (-parseInt(r(444)) / 12) + ) + break; + e.push(e.shift()); + } catch (n) { + e.push(e.shift()); + } +})(); +import { + whenButtonIsClicked, + readNumber, + readString, + displayString, +} from '../../../../../lib/dom-io/index.js'; +whenButtonIsClicked(_0x193672(447) + 'm', () => { + const n = _0x193672, + t = { + bhlNo: function (n, t) { + return n(t); + }, + nXfYs: n(435), + entPl: function (n, t) { + return n(t); + }, + FxzRG: n(437) + n(433), + nOrWu: function (n, t) { + return n < t; + }, + fntcZ: function (n, t, r) { + return n(t, r); + }, + kmWxk: n(446) + n(434), + }, + r = t[n(429)](readString, t[n(436)]), + e = t[n(426)](readNumber, t[n(443)]); + let f = ''; + for (const s of r) for (let r = 0; t[n(441)](r, e); r++) f += s; + t[n(449)](displayString, t[n(431)], f); +}); diff --git a/lesson-plans/for-loops/2-integrate/repeat-string/styles.css b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/styles.css similarity index 100% rename from lesson-plans/for-loops/2-integrate/repeat-string/styles.css rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/styles.css diff --git a/6-using-functions/5-dom-io/repeat-characters/utils/README.md b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/utils/README.md similarity index 100% rename from 6-using-functions/5-dom-io/repeat-characters/utils/README.md rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-characters/utils/README.md diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/index.html b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/index.html new file mode 100644 index 0000000..1208a9a --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/index.html @@ -0,0 +1,33 @@ + + + + + +
+ this many tines: +
+ + + +
+ +your output: + + +
+ +expected output: + +repeat string + + + + + ++ repeat this string: + + + + + diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/script.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/script.js new file mode 100644 index 0000000..09a1133 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/script.js @@ -0,0 +1,19 @@ +import { _ } from './utils/_.js'; + +/* Repeat Characters + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- define handler function --- + +const __ = () => {}; + +// --- pass callback to event listener --- + +_.addEventListener('click', __); diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/script.re.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/script.re.js new file mode 100644 index 0000000..d9e5941 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/script.re.js @@ -0,0 +1,91 @@ +function _0x364d() { + const t = [ + 'addEventLi', + 'stener', + '19969050iXGEmW', + 'ution', + 'rlmtC', + '37176xDqwGw', + 'number-of-', + '15vEcczn', + 'ById', + '6921702YqBkwt', + '410862hKLsbi', + 'cVVnX', + '651ihODJx', + 'wXtXa', + 'secret-sol', + 'repeat-it', + '2506018COgcFU', + 'click', + '15963UiJIHi', + 'getElement', + 'gLqRE', + '544KDZhZk', + 'user-text', + '1221794wbCcAS', + 'eBpLS', + 'TUmrR', + 'times', + ]; + return (_0x364d = function () { + return t; + })(); +} +const _0x42f7a6 = _0x4d63; +!(function (t, n) { + const r = _0x4d63, + e = _0x364d(); + for (;;) + try { + if ( + 788096 === + -parseInt(r(419)) / 1 + + -parseInt(r(412)) / 2 + + (parseInt(r(414)) / 3) * (parseInt(r(417)) / 4) + + (-parseInt(r(403)) / 5) * (-parseInt(r(406)) / 6) + + (-parseInt(r(408)) / 7) * (parseInt(r(401)) / 8) + + parseInt(r(405)) / 9 + + parseInt(r(398)) / 10 + ) + break; + e.push(e.shift()); + } catch (t) { + e.push(e.shift()); + } +})(); +import { + readNumber, + readString, + displayString, +} from '../../../../../lib/dom-io/index.js'; +function _0x4d63(t, n) { + const r = _0x364d(); + return (_0x4d63 = function (t, n) { + return r[(t -= 398)]; + })(t, n); +} +document[_0x42f7a6(415) + _0x42f7a6(404)](_0x42f7a6(411))[ + _0x42f7a6(423) + _0x42f7a6(424) +](_0x42f7a6(413), () => { + const t = _0x42f7a6, + n = { + gLqRE: function (t, n) { + return t(n); + }, + wXtXa: t(418), + TUmrR: t(402) + t(422), + eBpLS: function (t, n) { + return t < n; + }, + rlmtC: function (t, n, r) { + return t(n, r); + }, + cVVnX: t(410) + t(399), + }, + r = n[t(416)](readString, n[t(409)]), + e = n[t(416)](readNumber, n[t(421)]); + let a = ''; + for (let i = 0; n[t(420)](i, e); i++) a += r; + n[t(400)](displayString, n[t(407)], a); +}); diff --git a/lesson-plans/for-loops/2-integrate/reverse-string/styles.css b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/styles.css similarity index 100% rename from lesson-plans/for-loops/2-integrate/reverse-string/styles.css rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/styles.css diff --git a/6-using-functions/5-dom-io/repeat-string/utils/README.md b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/utils/README.md similarity index 100% rename from 6-using-functions/5-dom-io/repeat-string/utils/README.md rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/repeat-string/utils/README.md diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/index.html b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/index.html new file mode 100644 index 0000000..9f1fc4d --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/index.html @@ -0,0 +1,33 @@ + + + + + +
+ this many tines: +
+ + + +
+ +your output: + + +
+ +expected output: + +reverse string + + + + + ++ reverse this string: + + + + + diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/script.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/script.js new file mode 100644 index 0000000..09a1133 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/script.js @@ -0,0 +1,19 @@ +import { _ } from './utils/_.js'; + +/* Repeat Characters + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- define handler function --- + +const __ = () => {}; + +// --- pass callback to event listener --- + +_.addEventListener('click', __); diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/script.re.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/script.re.js new file mode 100644 index 0000000..dd03f9a --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/script.re.js @@ -0,0 +1,88 @@ +const _0x314480 = _0x370b; +function _0x3c24() { + const t = [ + 'RtJAe', + '2sGralD', + 'ution', + 'saDJo', + 'ById', + '11489488ZhWQBl', + 'reverse-it', + 'user-text', + 'PplZc', + '5554779kYUBJS', + 'length', + '504351VdYWlJ', + '30791057fMjkQa', + 'addEventLi', + 'TFJuj', + 'secret-sol', + '14DkCpAs', + '580632BfYZPy', + '60CGixJZ', + 'stener', + 'JojXJ', + '310esptOT', + 'getElement', + 'ruBFK', + '5543508jBnoNq', + '1398001ZOSIdc', + 'click', + ]; + return (_0x3c24 = function () { + return t; + })(); +} +!(function (t, n) { + const r = _0x370b, + e = _0x3c24(); + for (;;) + try { + if ( + 943114 === + -parseInt(r(272)) / 1 + + (parseInt(r(275)) / 2) * (parseInt(r(283)) / 3) + + (-parseInt(r(291)) / 4) * (-parseInt(r(292)) / 5) + + (-parseInt(r(271)) / 6) * (-parseInt(r(290)) / 7) + + parseInt(r(279)) / 8 + + (-parseInt(r(285)) / 9) * (parseInt(r(295)) / 10) + + -parseInt(r(286)) / 11 + ) + break; + e.push(e.shift()); + } catch (t) { + e.push(e.shift()); + } +})(); +import { readString, displayString } from '../../../../../lib/dom-io/index.js'; +function _0x370b(t, n) { + const r = _0x3c24(); + return (_0x370b = function (t, n) { + return r[(t -= 269)]; + })(t, n); +} +document[_0x314480(269) + _0x314480(278)](_0x314480(280))[ + _0x314480(287) + _0x314480(293) +](_0x314480(273), () => { + const t = _0x314480, + n = { + ruBFK: function (t, n) { + return t(n); + }, + RtJAe: t(281), + PplZc: function (t, n) { + return t - n; + }, + JojXJ: function (t, n) { + return t >= n; + }, + TFJuj: function (t, n, r) { + return t(n, r); + }, + saDJo: t(289) + t(276), + }, + r = n[t(270)](readString, n[t(274)]); + let e = ''; + for (let s = n[t(282)](r[t(284)], 1); n[t(294)](s, 0); s--) e += r[s]; + n[t(288)](displayString, n[t(277)], e); +}); diff --git a/lesson-plans/for-loops/2-integrate/skip/styles.css b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/styles.css similarity index 100% rename from lesson-plans/for-loops/2-integrate/skip/styles.css rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/styles.css diff --git a/6-using-functions/5-dom-io/reverse-string/utils/README.md b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/utils/README.md similarity index 100% rename from 6-using-functions/5-dom-io/reverse-string/utils/README.md rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/reverse-string/utils/README.md diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/index.html b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/index.html new file mode 100644 index 0000000..a111a79 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/index.html @@ -0,0 +1,34 @@ + + + + + +
+ +
+ + + +
+ +your output: + + +
+ +expected output: + +skip + + + + + ++ skip this many characters: + + + + + + diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/script.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/script.js new file mode 100644 index 0000000..09a1133 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/script.js @@ -0,0 +1,19 @@ +import { _ } from './utils/_.js'; + +/* Repeat Characters + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- define handler function --- + +const __ = () => {}; + +// --- pass callback to event listener --- + +_.addEventListener('click', __); diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/script.re.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/script.re.js new file mode 100644 index 0000000..6e87515 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/script.re.js @@ -0,0 +1,96 @@ +function _0x5b54(n, t) { + const e = _0x2a56(); + return (_0x5b54 = function (n, t) { + return e[(n -= 199)]; + })(n, t); +} +function _0x2a56() { + const n = [ + 'kHICf', + 'XwHbC', + 'skip-them', + 'VsvhF', + '5463430cRDskf', + '4KEeUAy', + '46258641CmQbjR', + 'kffQS', + '12807wJnILJ', + 'addEventLi', + '2152FsYdQN', + 'HioKn', + 'stener', + 'skip-size', + 'user-text', + '552588OsvZEs', + 'ById', + '49XuJxYZ', + '64xBKQGk', + 'Uubme', + 'secret-sol', + 'click', + 'ution', + 'BLjwT', + 'getElement', + '3964173urgyfO', + '13071740pCVQqY', + 'length', + '1721nGSSIv', + ]; + return (_0x2a56 = function () { + return n; + })(); +} +const _0x1c928d = _0x5b54; +!(function (n, t) { + const e = _0x5b54, + r = _0x2a56(); + for (;;) + try { + if ( + 690907 === + (-parseInt(e(224)) / 1) * (parseInt(e(214)) / 2) + + -parseInt(e(221)) / 3 + + (parseInt(e(201)) / 4) * (-parseInt(e(200)) / 5) + + (-parseInt(e(211)) / 6) * (-parseInt(e(213)) / 7) + + (-parseInt(e(206)) / 8) * (parseInt(e(204)) / 9) + + -parseInt(e(222)) / 10 + + parseInt(e(202)) / 11 + ) + break; + r.push(r.shift()); + } catch (n) { + r.push(r.shift()); + } +})(); +import { + readNumber, + readString, + displayString, +} from '../../../../../lib/dom-io/index.js'; +document[_0x1c928d(220) + _0x1c928d(212)](_0x1c928d(227))[ + _0x1c928d(205) + _0x1c928d(208) +](_0x1c928d(217), () => { + const n = _0x1c928d, + t = { + HioKn: function (n, t) { + return n(t); + }, + kffQS: n(210), + Uubme: n(209), + kHICf: function (n, t) { + return n < t; + }, + VsvhF: function (n, t) { + return n + t; + }, + BLjwT: function (n, t, e) { + return n(t, e); + }, + XwHbC: n(216) + n(218), + }, + e = t[n(207)](readString, t[n(203)]), + r = t[n(207)](readNumber, t[n(215)]); + let s = ''; + for (let c = 0; t[n(225)](c, e[n(223)]); c = t[n(199)](c, r)) s += e[c]; + t[n(219)](displayString, t[n(226)], s); +}); diff --git a/lesson-plans/for-loops/2-integrate/upside-down-pyramid/styles.css b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/styles.css similarity index 100% rename from lesson-plans/for-loops/2-integrate/upside-down-pyramid/styles.css rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/styles.css diff --git a/6-using-functions/5-dom-io/skip/utils/README.md b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/utils/README.md similarity index 100% rename from 6-using-functions/5-dom-io/skip/utils/README.md rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/skip/utils/README.md diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/index.html b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/index.html new file mode 100644 index 0000000..de21347 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/index.html @@ -0,0 +1,34 @@ + + + + + +
+ in this text: +
+ + + +
+ +your output: + + +
+ +expected output: + +upside down pyramid + + + + + ++ create an upside down pyramid with this text: + + + + + + + + diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/script.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/script.js new file mode 100644 index 0000000..09a1133 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/script.js @@ -0,0 +1,19 @@ +import { _ } from './utils/_.js'; + +/* Repeat Characters + + + +*/ + +// --- saved DOM Elements --- + +_; + +// --- define handler function --- + +const __ = () => {}; + +// --- pass callback to event listener --- + +_.addEventListener('click', __); diff --git a/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/script.re.js b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/script.re.js new file mode 100644 index 0000000..e010898 --- /dev/null +++ b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/script.re.js @@ -0,0 +1,90 @@ +const _0x249d7f = _0x517a; +function _0x517a(n, t) { + const r = _0x4fac(); + return (_0x517a = function (n, t) { + return r[(n -= 175)]; + })(n, t); +} +!(function (n, t) { + const r = _0x517a, + e = _0x4fac(); + for (;;) + try { + if ( + 641495 === + parseInt(r(193)) / 1 + + -parseInt(r(184)) / 2 + + (parseInt(r(195)) / 3) * (-parseInt(r(177)) / 4) + + (-parseInt(r(187)) / 5) * (parseInt(r(198)) / 6) + + parseInt(r(196)) / 7 + + parseInt(r(186)) / 8 + + (parseInt(r(199)) / 9) * (parseInt(r(178)) / 10) + ) + break; + e.push(e.shift()); + } catch (n) { + e.push(e.shift()); + } +})(); +import { readString, displayString } from '../../../../../lib/dom-io/index.js'; +function _0x4fac() { + const n = [ + 'to-pyramid', + '3340072QrvFwP', + '50930pLpoKj', + 'ution', + 'ById', + 'secret-sol', + 'ccDch', + 'getElement', + '2424030gpGmyH', + 'addEventLi', + '9265040iFTJJE', + '1940910mgQmNz', + 'length', + 'aYXJC', + 'pyramid-it', + 'bqqNJ', + 'qeRNO', + '999977NCkfOA', + 'sdFYm', + '3wHpAjJ', + '3407684jOdLws', + 'stener', + '12KYhpIp', + '1449MydWXK', + 'mnVKk', + 'click', + ]; + return (_0x4fac = function () { + return n; + })(); +} +document[_0x249d7f(183) + _0x249d7f(180)](_0x249d7f(190))[ + _0x249d7f(185) + _0x249d7f(197) +](_0x249d7f(175), () => { + const n = _0x249d7f, + t = { + sdFYm: function (n, t) { + return n(t); + }, + ccDch: n(176), + qeRNO: function (n, t) { + return n < t; + }, + mnVKk: function (n, t) { + return n < t; + }, + aYXJC: function (n, t, r) { + return n(t, r); + }, + bqqNJ: n(181) + n(179), + }, + r = t[n(194)](readString, t[n(182)]); + let e = ''; + for (let c = 0; t[n(192)](c, r[n(188)]); c++) { + for (let a = c; t[n(200)](a, r[n(188)]); a++) e += r[a]; + e += '\n'; + } + t[n(189)](displayString, t[n(191)], e); +}); diff --git a/lesson-plans/group-project-intro/examples/cat-advice/styles.css b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/styles.css similarity index 100% rename from lesson-plans/group-project-intro/examples/cat-advice/styles.css rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/styles.css diff --git a/6-using-functions/5-dom-io/upside-down-pyramid/utils/README.md b/07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/utils/README.md similarity index 100% rename from 6-using-functions/5-dom-io/upside-down-pyramid/utils/README.md rename to 07-using-functions/5-dom-ui/exercises/2-reverse-engineering/upside-down-pyramid/utils/README.md diff --git a/6-using-functions/README.md b/07-using-functions/README.md similarity index 95% rename from 6-using-functions/README.md rename to 07-using-functions/README.md index 71fc6ca..2a70fc7 100644 --- a/6-using-functions/README.md +++ b/07-using-functions/README.md @@ -75,11 +75,11 @@ use functions (remember zooming in and zooming out?): * @returns {string} the reversed text */ const reverseString = (text = '') => { - let backwards = ''; - for (const character of text) { - backwards = character + backwards; - } - return backwards; + let backwards = ''; + for (const character of text) { + backwards = character + backwards; + } + return backwards; }; console.assert(reverseString('') === '', 'Test 1'); console.assert(reverseString('1234') === '4321', 'Test 2'); @@ -92,7 +92,7 @@ console.assert(reverseString('ooo') === 'ooo', 'Test 5'); // -- gather user input -- let input = null; while (input === null) { - input = prompt('enter some text to reverse'); + input = prompt('enter some text to reverse'); } // -- use your program logic -- @@ -163,3 +163,8 @@ will make your code easier to read, to test and to develop as a team. Practice using, writing and refactoring functions that process arrays. Be careful of side-effects! Your functions should return new arrays and not modify the original one. + +### 5. DOM UI + +Do all that stuff up there, but in event-driven programs with a proper DOM user +interface. diff --git a/07-using-functions/study.json b/07-using-functions/study.json new file mode 100644 index 0000000..9f7ecb8 --- /dev/null +++ b/07-using-functions/study.json @@ -0,0 +1,8 @@ +{ + "study": { + "type": "module", + "environment": true, + "ask": false, + "trace": false + } +} diff --git a/7-arrays/1-isolate/1-arrays/examples/holding-many-things.js b/08-arrays/1-isolate/1-arrays/examples/holding-many-things.js similarity index 100% rename from 7-arrays/1-isolate/1-arrays/examples/holding-many-things.js rename to 08-arrays/1-isolate/1-arrays/examples/holding-many-things.js diff --git a/7-arrays/1-isolate/1-arrays/examples/setting-entries-by-index.js b/08-arrays/1-isolate/1-arrays/examples/setting-entries-by-index.js similarity index 100% rename from 7-arrays/1-isolate/1-arrays/examples/setting-entries-by-index.js rename to 08-arrays/1-isolate/1-arrays/examples/setting-entries-by-index.js diff --git a/7-arrays/1-isolate/1-arrays/exercises/1-assert-one-array.js b/08-arrays/1-isolate/1-arrays/exercises/1-assert-one-array.js similarity index 100% rename from 7-arrays/1-isolate/1-arrays/exercises/1-assert-one-array.js rename to 08-arrays/1-isolate/1-arrays/exercises/1-assert-one-array.js diff --git a/7-arrays/1-isolate/1-arrays/exercises/2-write-one-array.js b/08-arrays/1-isolate/1-arrays/exercises/2-write-one-array.js similarity index 100% rename from 7-arrays/1-isolate/1-arrays/exercises/2-write-one-array.js rename to 08-arrays/1-isolate/1-arrays/exercises/2-write-one-array.js diff --git a/7-arrays/1-isolate/1-arrays/exercises/3-assert-array-comparisons.js b/08-arrays/1-isolate/1-arrays/exercises/3-assert-array-comparisons.js similarity index 100% rename from 7-arrays/1-isolate/1-arrays/exercises/3-assert-array-comparisons.js rename to 08-arrays/1-isolate/1-arrays/exercises/3-assert-array-comparisons.js diff --git a/7-arrays/1-isolate/1-arrays/exercises/4-write-second-array.js b/08-arrays/1-isolate/1-arrays/exercises/4-write-second-array.js similarity index 100% rename from 7-arrays/1-isolate/1-arrays/exercises/4-write-second-array.js rename to 08-arrays/1-isolate/1-arrays/exercises/4-write-second-array.js diff --git a/7-arrays/1-isolate/2-for-of-arrays/1-for-of-arrays.js b/08-arrays/1-isolate/2-for-of-arrays/1-for-of-arrays.js similarity index 100% rename from 7-arrays/1-isolate/2-for-of-arrays/1-for-of-arrays.js rename to 08-arrays/1-isolate/2-for-of-arrays/1-for-of-arrays.js diff --git a/7-arrays/1-isolate/2-for-of-arrays/2-limitations.js b/08-arrays/1-isolate/2-for-of-arrays/2-limitations.js similarity index 100% rename from 7-arrays/1-isolate/2-for-of-arrays/2-limitations.js rename to 08-arrays/1-isolate/2-for-of-arrays/2-limitations.js diff --git a/7-arrays/1-isolate/2-for-of-arrays/3-infinite-loops.js b/08-arrays/1-isolate/2-for-of-arrays/3-infinite-loops.js similarity index 100% rename from 7-arrays/1-isolate/2-for-of-arrays/3-infinite-loops.js rename to 08-arrays/1-isolate/2-for-of-arrays/3-infinite-loops.js diff --git a/7-arrays/1-isolate/5-reference-vs-value/examples/1-shared-reference.js b/08-arrays/1-isolate/5-reference-vs-value/examples/1-shared-reference.js similarity index 100% rename from 7-arrays/1-isolate/5-reference-vs-value/examples/1-shared-reference.js rename to 08-arrays/1-isolate/5-reference-vs-value/examples/1-shared-reference.js diff --git a/7-arrays/1-isolate/5-reference-vs-value/examples/2-const-with-reference.js b/08-arrays/1-isolate/5-reference-vs-value/examples/2-const-with-reference.js similarity index 100% rename from 7-arrays/1-isolate/5-reference-vs-value/examples/2-const-with-reference.js rename to 08-arrays/1-isolate/5-reference-vs-value/examples/2-const-with-reference.js diff --git a/7-arrays/1-isolate/5-reference-vs-value/examples/3-comparing.js b/08-arrays/1-isolate/5-reference-vs-value/examples/3-comparing.js similarity index 100% rename from 7-arrays/1-isolate/5-reference-vs-value/examples/3-comparing.js rename to 08-arrays/1-isolate/5-reference-vs-value/examples/3-comparing.js diff --git a/7-arrays/1-isolate/5-reference-vs-value/examples/4-deep-comparing.js b/08-arrays/1-isolate/5-reference-vs-value/examples/4-deep-comparing.js similarity index 100% rename from 7-arrays/1-isolate/5-reference-vs-value/examples/4-deep-comparing.js rename to 08-arrays/1-isolate/5-reference-vs-value/examples/4-deep-comparing.js diff --git a/7-arrays/1-isolate/5-reference-vs-value/examples/extra--circular-references.js b/08-arrays/1-isolate/5-reference-vs-value/examples/extra--circular-references.js similarity index 100% rename from 7-arrays/1-isolate/5-reference-vs-value/examples/extra--circular-references.js rename to 08-arrays/1-isolate/5-reference-vs-value/examples/extra--circular-references.js diff --git a/7-arrays/1-isolate/5-reference-vs-value/exercises/1-fill-in-blanks.js b/08-arrays/1-isolate/5-reference-vs-value/exercises/1-fill-in-blanks.js similarity index 92% rename from 7-arrays/1-isolate/5-reference-vs-value/exercises/1-fill-in-blanks.js rename to 08-arrays/1-isolate/5-reference-vs-value/exercises/1-fill-in-blanks.js index 2d55012..86612cb 100644 --- a/7-arrays/1-isolate/5-reference-vs-value/exercises/1-fill-in-blanks.js +++ b/08-arrays/1-isolate/5-reference-vs-value/exercises/1-fill-in-blanks.js @@ -1,8 +1,12 @@ 'use strict'; +// ===== helper function ===== + // prettier-ignore const deepCompare = (actual, expect) => actual === expect || Object.is(actual, expect) || (Object(actual) === actual && Object(expect) === expect) && (Array.isArray(actual) && Array.isArray(expect) && actual.length === expect.length && expect.every((expect, index) => deepCompare(actual[index], expect)) || Object.keys(actual).length === Object.keys(expect).length && Object.keys(expect).every((key) => deepCompare(actual[key], expect[key]))); +// ===== main program ===== + // one array in memory // how many solutions can you find? // psst. use JS Tutor & the debugger diff --git a/7-arrays/1-isolate/5-reference-vs-value/exercises/2-fill-in-blanks.js b/08-arrays/1-isolate/5-reference-vs-value/exercises/2-fill-in-blanks.js similarity index 92% rename from 7-arrays/1-isolate/5-reference-vs-value/exercises/2-fill-in-blanks.js rename to 08-arrays/1-isolate/5-reference-vs-value/exercises/2-fill-in-blanks.js index 7451676..4555f86 100644 --- a/7-arrays/1-isolate/5-reference-vs-value/exercises/2-fill-in-blanks.js +++ b/08-arrays/1-isolate/5-reference-vs-value/exercises/2-fill-in-blanks.js @@ -1,8 +1,12 @@ 'use strict'; +// ===== helper function ===== + // prettier-ignore const deepCompare = (actual, expect) => actual === expect || Object.is(actual, expect) || (Object(actual) === actual && Object(expect) === expect) && (Array.isArray(actual) && Array.isArray(expect) && actual.length === expect.length && expect.every((expect, index) => deepCompare(actual[index], expect)) || Object.keys(actual).length === Object.keys(expect).length && Object.keys(expect).every((key) => deepCompare(actual[key], expect[key]))); +// ===== main program ===== + // two different arrays with the same values // how many solutions can you find? // psst. use JS Tutor & the debugger diff --git a/7-arrays/1-isolate/5-reference-vs-value/exercises/3-fill-in-blanks.js b/08-arrays/1-isolate/5-reference-vs-value/exercises/3-fill-in-blanks.js similarity index 93% rename from 7-arrays/1-isolate/5-reference-vs-value/exercises/3-fill-in-blanks.js rename to 08-arrays/1-isolate/5-reference-vs-value/exercises/3-fill-in-blanks.js index 740ec9d..73999ae 100644 --- a/7-arrays/1-isolate/5-reference-vs-value/exercises/3-fill-in-blanks.js +++ b/08-arrays/1-isolate/5-reference-vs-value/exercises/3-fill-in-blanks.js @@ -1,8 +1,12 @@ 'use strict'; +// ===== helper function ===== + // prettier-ignore const deepCompare = (actual, expect) => actual === expect || Object.is(actual, expect) || (Object(actual) === actual && Object(expect) === expect) && (Array.isArray(actual) && Array.isArray(expect) && actual.length === expect.length && expect.every((expect, index) => deepCompare(actual[index], expect)) || Object.keys(actual).length === Object.keys(expect).length && Object.keys(expect).every((key) => deepCompare(actual[key], expect[key]))); +// ===== main program ===== + // two different arrays with different values // how many solutions can you find? // psst. use JS Tutor & the debugger diff --git a/7-arrays/1-isolate/5-reference-vs-value/exercises/swap-arrays.js b/08-arrays/1-isolate/5-reference-vs-value/exercises/swap-arrays.js similarity index 100% rename from 7-arrays/1-isolate/5-reference-vs-value/exercises/swap-arrays.js rename to 08-arrays/1-isolate/5-reference-vs-value/exercises/swap-arrays.js diff --git a/7-arrays/1-isolate/5-reference-vs-value/exercises/swap-items.js b/08-arrays/1-isolate/5-reference-vs-value/exercises/swap-items.js similarity index 100% rename from 7-arrays/1-isolate/5-reference-vs-value/exercises/swap-items.js rename to 08-arrays/1-isolate/5-reference-vs-value/exercises/swap-items.js diff --git a/7-arrays/1-isolate/6-side-effects/examples/1-passing-arrays-as-arguments.js b/08-arrays/1-isolate/6-side-effects/examples/1-passing-arrays-as-arguments.js similarity index 100% rename from 7-arrays/1-isolate/6-side-effects/examples/1-passing-arrays-as-arguments.js rename to 08-arrays/1-isolate/6-side-effects/examples/1-passing-arrays-as-arguments.js diff --git a/7-arrays/1-isolate/6-side-effects/examples/2-side-effects.js b/08-arrays/1-isolate/6-side-effects/examples/2-side-effects.js similarity index 100% rename from 7-arrays/1-isolate/6-side-effects/examples/2-side-effects.js rename to 08-arrays/1-isolate/6-side-effects/examples/2-side-effects.js diff --git a/7-arrays/1-isolate/6-side-effects/examples/3-avoiding-side-effects.js b/08-arrays/1-isolate/6-side-effects/examples/3-avoiding-side-effects.js similarity index 100% rename from 7-arrays/1-isolate/6-side-effects/examples/3-avoiding-side-effects.js rename to 08-arrays/1-isolate/6-side-effects/examples/3-avoiding-side-effects.js diff --git a/7-arrays/1-isolate/6-side-effects/examples/4-testing-for-side-effects.js b/08-arrays/1-isolate/6-side-effects/examples/4-testing-for-side-effects.js similarity index 86% rename from 7-arrays/1-isolate/6-side-effects/examples/4-testing-for-side-effects.js rename to 08-arrays/1-isolate/6-side-effects/examples/4-testing-for-side-effects.js index a48b5ad..1f429a0 100644 --- a/7-arrays/1-isolate/6-side-effects/examples/4-testing-for-side-effects.js +++ b/08-arrays/1-isolate/6-side-effects/examples/4-testing-for-side-effects.js @@ -1,8 +1,12 @@ 'use strict'; +// ===== helper function ===== + // prettier-ignore const deepCompare = (actual, expect) => actual === expect || Object.is(actual, expect) || (Object(actual) === actual && Object(expect) === expect) && (Array.isArray(actual) && Array.isArray(expect) && actual.length === expect.length && expect.every((expect, index) => deepCompare(actual[index], expect)) || Object.keys(actual).length === Object.keys(expect).length && Object.keys(expect).every((key) => deepCompare(actual[key], expect[key]))); +// ===== main program ===== + /* you can test for side effects by making sure the argument has not changed @@ -10,12 +14,12 @@ const deepCompare = (actual, expect) => actual === expect || Object.is(actual, e */ const noSideEffect = (oldArray = [], index = 0, newValue = '') => { - const newArray = []; - for (const item of oldArray) { - newArray.push(item); - } - newArray[index] = newValue; - return newArray; + const newArray = []; + for (const item of oldArray) { + newArray.push(item); + } + newArray[index] = newValue; + return newArray; }; const arg1 = ['table', 'chair', 'sofa']; @@ -31,8 +35,8 @@ console.assert(argWasNotModified1, 'arg1 was not modified'); // --------- yes, a side-effect --------- const yesSideEffect = (array, index, newValue) => { - array[index] = newValue; - return array; + array[index] = newValue; + return array; }; const arg2 = ['table', 'chair', 'sofa']; diff --git a/7-arrays/1-isolate/6-side-effects/examples/5-sneaky-array-methods.js b/08-arrays/1-isolate/6-side-effects/examples/5-sneaky-array-methods.js similarity index 100% rename from 7-arrays/1-isolate/6-side-effects/examples/5-sneaky-array-methods.js rename to 08-arrays/1-isolate/6-side-effects/examples/5-sneaky-array-methods.js diff --git a/7-arrays/1-isolate/6-side-effects/exercises/1-copy-array.js b/08-arrays/1-isolate/6-side-effects/exercises/1-copy-array.js similarity index 78% rename from 7-arrays/1-isolate/6-side-effects/exercises/1-copy-array.js rename to 08-arrays/1-isolate/6-side-effects/exercises/1-copy-array.js index e5b89e2..65a96e8 100644 --- a/7-arrays/1-isolate/6-side-effects/exercises/1-copy-array.js +++ b/08-arrays/1-isolate/6-side-effects/exercises/1-copy-array.js @@ -1,8 +1,12 @@ 'use strict'; +// ===== helper function ===== + // prettier-ignore const deepCompare = (actual, expect) => actual === expect || Object.is(actual, expect) || (Object(actual) === actual && Object(expect) === expect) && (Array.isArray(actual) && Array.isArray(expect) && actual.length === expect.length && expect.every((expect, index) => deepCompare(actual[index], expect)) || Object.keys(actual).length === Object.keys(expect).length && Object.keys(expect).every((key) => deepCompare(actual[key], expect[key]))); +// ===== main program ===== + /** * Returns a shallow copy of an array. * @@ -15,8 +19,8 @@ const _1_arg = [1, 2, 3]; const _1_returned = copyArray(_1_arg); console.assert(_1_arg !== _1_returned, '1.a: it returns a new array'); console.assert( - deepCompare(_1_returned, [1, 2, 3]), - '1.b: with the same values', + deepCompare(_1_returned, [1, 2, 3]), + '1.b: with the same values', ); console.assert(deepCompare(_1_arg, [1, 2, 3]), '2.c: _1_arg was not modified'); @@ -24,10 +28,10 @@ const _2_arg = [10, 11, 12, 13]; const _2_returned = copyArray(_2_arg); console.assert(_2_arg !== _2_returned, '2.a: returns a new array'); console.assert( - deepCompare(_2_returned, [10, 11, 12, 13]), - '2.b: with the same values', + deepCompare(_2_returned, [10, 11, 12, 13]), + '2.b: with the same values', ); console.assert( - deepCompare(_2_arg, [10, 11, 12, 13]), - '2.c: _2_arg was not modified', + deepCompare(_2_arg, [10, 11, 12, 13]), + '2.c: _2_arg was not modified', ); diff --git a/7-arrays/1-isolate/6-side-effects/exercises/2-reverse-array.js b/08-arrays/1-isolate/6-side-effects/exercises/2-reverse-array.js similarity index 79% rename from 7-arrays/1-isolate/6-side-effects/exercises/2-reverse-array.js rename to 08-arrays/1-isolate/6-side-effects/exercises/2-reverse-array.js index 0685684..2fe7d28 100644 --- a/7-arrays/1-isolate/6-side-effects/exercises/2-reverse-array.js +++ b/08-arrays/1-isolate/6-side-effects/exercises/2-reverse-array.js @@ -1,8 +1,12 @@ 'use strict'; +// ===== helper function ===== + // prettier-ignore const deepCompare = (actual, expect) => actual === expect || Object.is(actual, expect) || (Object(actual) === actual && Object(expect) === expect) && (Array.isArray(actual) && Array.isArray(expect) && actual.length === expect.length && expect.every((expect, index) => deepCompare(actual[index], expect)) || Object.keys(actual).length === Object.keys(expect).length && Object.keys(expect).every((key) => deepCompare(actual[key], expect[key]))); +// ===== main program ===== + /** * Reverses an array without modifying the parameter. * @@ -15,8 +19,8 @@ const _1_arg = [1, 2, 3]; const _1_returned = reverseArray(_1_arg); console.assert(_1_arg !== _1_returned, '1.a: returns a new array'); console.assert( - deepCompare(_1_returned, [3, 2, 1]), - '1.b: reverses the entries', + deepCompare(_1_returned, [3, 2, 1]), + '1.b: reverses the entries', ); console.assert(deepCompare(_1_arg, [1, 2, 3]), '1.c: _1_arg was not modified'); @@ -24,10 +28,10 @@ const _2_arg = [10, 11, 12, 13]; const _2_returned = reverseArray(_2_arg); console.assert(_2_arg !== _2_returned, '2.a: returns a new array'); console.assert( - deepCompare(_2_returned, [13, 12, 11, 10]), - '2.b: reverses the entries', + deepCompare(_2_returned, [13, 12, 11, 10]), + '2.b: reverses the entries', ); console.assert( - deepCompare(_2_arg, [10, 11, 12, 13]), - '2.c: _2_arg was not modified', + deepCompare(_2_arg, [10, 11, 12, 13]), + '2.c: _2_arg was not modified', ); diff --git a/7-arrays/1-isolate/6-side-effects/filling-cups.gif b/08-arrays/1-isolate/6-side-effects/filling-cups.gif similarity index 100% rename from 7-arrays/1-isolate/6-side-effects/filling-cups.gif rename to 08-arrays/1-isolate/6-side-effects/filling-cups.gif diff --git a/08-arrays/1-isolate/study.json b/08-arrays/1-isolate/study.json new file mode 100644 index 0000000..b666c63 --- /dev/null +++ b/08-arrays/1-isolate/study.json @@ -0,0 +1,6 @@ +{ + "study": { + "openIn": "jsTutorLive", + "ask": false + } +} diff --git a/7-arrays/2-practice/0-comparing-arrays/expect-deep-compares.test.js b/08-arrays/2-practice/0-comparing-arrays/expect-deep-compares.test.js similarity index 100% rename from 7-arrays/2-practice/0-comparing-arrays/expect-deep-compares.test.js rename to 08-arrays/2-practice/0-comparing-arrays/expect-deep-compares.test.js diff --git a/7-arrays/2-practice/1-write-tests/keep-long-strings.js b/08-arrays/2-practice/1-write-tests/keep-long-strings.js similarity index 100% rename from 7-arrays/2-practice/1-write-tests/keep-long-strings.js rename to 08-arrays/2-practice/1-write-tests/keep-long-strings.js diff --git a/7-arrays/2-practice/1-write-tests/keep-long-strings.spec.js b/08-arrays/2-practice/1-write-tests/keep-long-strings.spec.js similarity index 100% rename from 7-arrays/2-practice/1-write-tests/keep-long-strings.spec.js rename to 08-arrays/2-practice/1-write-tests/keep-long-strings.spec.js diff --git a/7-arrays/2-practice/1-write-tests/some-long.js b/08-arrays/2-practice/1-write-tests/some-long.js similarity index 100% rename from 7-arrays/2-practice/1-write-tests/some-long.js rename to 08-arrays/2-practice/1-write-tests/some-long.js diff --git a/7-arrays/2-practice/1-write-tests/some-long.spec.js b/08-arrays/2-practice/1-write-tests/some-long.spec.js similarity index 100% rename from 7-arrays/2-practice/1-write-tests/some-long.spec.js rename to 08-arrays/2-practice/1-write-tests/some-long.spec.js diff --git a/7-arrays/2-practice/2-fix-bugs/all-long.js b/08-arrays/2-practice/2-fix-bugs/all-long.js similarity index 100% rename from 7-arrays/2-practice/2-fix-bugs/all-long.js rename to 08-arrays/2-practice/2-fix-bugs/all-long.js diff --git a/7-arrays/2-practice/2-fix-bugs/all-long.spec.js b/08-arrays/2-practice/2-fix-bugs/all-long.spec.js similarity index 100% rename from 7-arrays/2-practice/2-fix-bugs/all-long.spec.js rename to 08-arrays/2-practice/2-fix-bugs/all-long.spec.js diff --git a/7-arrays/2-practice/2-fix-bugs/reverse-array.js b/08-arrays/2-practice/2-fix-bugs/reverse-array.js similarity index 100% rename from 7-arrays/2-practice/2-fix-bugs/reverse-array.js rename to 08-arrays/2-practice/2-fix-bugs/reverse-array.js diff --git a/7-arrays/2-practice/2-fix-bugs/reverse-array.spec.js b/08-arrays/2-practice/2-fix-bugs/reverse-array.spec.js similarity index 100% rename from 7-arrays/2-practice/2-fix-bugs/reverse-array.spec.js rename to 08-arrays/2-practice/2-fix-bugs/reverse-array.spec.js diff --git a/7-arrays/2-practice/3-write-functions/long-to-upper.js b/08-arrays/2-practice/3-write-functions/long-to-upper.js similarity index 100% rename from 7-arrays/2-practice/3-write-functions/long-to-upper.js rename to 08-arrays/2-practice/3-write-functions/long-to-upper.js diff --git a/7-arrays/2-practice/3-write-functions/long-to-upper.spec.js b/08-arrays/2-practice/3-write-functions/long-to-upper.spec.js similarity index 100% rename from 7-arrays/2-practice/3-write-functions/long-to-upper.spec.js rename to 08-arrays/2-practice/3-write-functions/long-to-upper.spec.js diff --git a/7-arrays/2-practice/3-write-functions/replace-entry.js b/08-arrays/2-practice/3-write-functions/replace-entry.js similarity index 100% rename from 7-arrays/2-practice/3-write-functions/replace-entry.js rename to 08-arrays/2-practice/3-write-functions/replace-entry.js diff --git a/7-arrays/2-practice/3-write-functions/replace-entry.spec.js b/08-arrays/2-practice/3-write-functions/replace-entry.spec.js similarity index 100% rename from 7-arrays/2-practice/3-write-functions/replace-entry.spec.js rename to 08-arrays/2-practice/3-write-functions/replace-entry.spec.js diff --git a/08-arrays/2-practice/study.json b/08-arrays/2-practice/study.json new file mode 100644 index 0000000..9a9d7c7 --- /dev/null +++ b/08-arrays/2-practice/study.json @@ -0,0 +1,6 @@ +{ + "study": { + "type": "module", + "environment": true + } +} diff --git a/7-arrays/3-integrate/README.md b/08-arrays/3-integrate/README.md similarity index 97% rename from 7-arrays/3-integrate/README.md rename to 08-arrays/3-integrate/README.md index 71fc6ca..d863fb6 100644 --- a/7-arrays/3-integrate/README.md +++ b/08-arrays/3-integrate/README.md @@ -75,11 +75,11 @@ use functions (remember zooming in and zooming out?): * @returns {string} the reversed text */ const reverseString = (text = '') => { - let backwards = ''; - for (const character of text) { - backwards = character + backwards; - } - return backwards; + let backwards = ''; + for (const character of text) { + backwards = character + backwards; + } + return backwards; }; console.assert(reverseString('') === '', 'Test 1'); console.assert(reverseString('1234') === '4321', 'Test 2'); @@ -92,7 +92,7 @@ console.assert(reverseString('ooo') === 'ooo', 'Test 5'); // -- gather user input -- let input = null; while (input === null) { - input = prompt('enter some text to reverse'); + input = prompt('enter some text to reverse'); } // -- use your program logic -- diff --git a/7-arrays/3-integrate/examples/sum.js b/08-arrays/3-integrate/examples/sum.js similarity index 100% rename from 7-arrays/3-integrate/examples/sum.js rename to 08-arrays/3-integrate/examples/sum.js diff --git a/7-arrays/3-integrate/examples/utils/add-numbers.js b/08-arrays/3-integrate/examples/utils/add-numbers.js similarity index 100% rename from 7-arrays/3-integrate/examples/utils/add-numbers.js rename to 08-arrays/3-integrate/examples/utils/add-numbers.js diff --git a/7-arrays/3-integrate/examples/utils/add-numbers.spec.js b/08-arrays/3-integrate/examples/utils/add-numbers.spec.js similarity index 100% rename from 7-arrays/3-integrate/examples/utils/add-numbers.spec.js rename to 08-arrays/3-integrate/examples/utils/add-numbers.spec.js diff --git a/7-arrays/3-integrate/exercises/1-call/add-something.js b/08-arrays/3-integrate/exercises/1-call/add-something.js similarity index 100% rename from 7-arrays/3-integrate/exercises/1-call/add-something.js rename to 08-arrays/3-integrate/exercises/1-call/add-something.js diff --git a/7-arrays/3-integrate/exercises/1-call/longness.js b/08-arrays/3-integrate/exercises/1-call/longness.js similarity index 100% rename from 7-arrays/3-integrate/exercises/1-call/longness.js rename to 08-arrays/3-integrate/exercises/1-call/longness.js diff --git a/7-arrays/3-integrate/exercises/2-write/find-matches.js b/08-arrays/3-integrate/exercises/2-write/find-matches.js similarity index 100% rename from 7-arrays/3-integrate/exercises/2-write/find-matches.js rename to 08-arrays/3-integrate/exercises/2-write/find-matches.js diff --git a/7-arrays/3-integrate/exercises/3-refactor/find-average.js b/08-arrays/3-integrate/exercises/3-refactor/find-average.js similarity index 100% rename from 7-arrays/3-integrate/exercises/3-refactor/find-average.js rename to 08-arrays/3-integrate/exercises/3-refactor/find-average.js diff --git a/7-arrays/3-integrate/exercises/4-reverse-engineer/keep-or-remove.js b/08-arrays/3-integrate/exercises/4-reverse-engineer/keep-or-remove.js similarity index 100% rename from 7-arrays/3-integrate/exercises/4-reverse-engineer/keep-or-remove.js rename to 08-arrays/3-integrate/exercises/4-reverse-engineer/keep-or-remove.js diff --git a/7-arrays/3-integrate/exercises/4-reverse-engineer/keep-or-remove.re.js b/08-arrays/3-integrate/exercises/4-reverse-engineer/keep-or-remove.re.js similarity index 100% rename from 7-arrays/3-integrate/exercises/4-reverse-engineer/keep-or-remove.re.js rename to 08-arrays/3-integrate/exercises/4-reverse-engineer/keep-or-remove.re.js diff --git a/7-arrays/3-integrate/exercises/4-reverse-engineer/search-inputs.js b/08-arrays/3-integrate/exercises/4-reverse-engineer/search-inputs.js similarity index 100% rename from 7-arrays/3-integrate/exercises/4-reverse-engineer/search-inputs.js rename to 08-arrays/3-integrate/exercises/4-reverse-engineer/search-inputs.js diff --git a/7-arrays/3-integrate/exercises/4-reverse-engineer/search-inputs.re.js b/08-arrays/3-integrate/exercises/4-reverse-engineer/search-inputs.re.js similarity index 100% rename from 7-arrays/3-integrate/exercises/4-reverse-engineer/search-inputs.re.js rename to 08-arrays/3-integrate/exercises/4-reverse-engineer/search-inputs.re.js diff --git a/7-arrays/3-integrate/exercises/utils/add-to-numbers.js b/08-arrays/3-integrate/exercises/utils/add-to-numbers.js similarity index 100% rename from 7-arrays/3-integrate/exercises/utils/add-to-numbers.js rename to 08-arrays/3-integrate/exercises/utils/add-to-numbers.js diff --git a/7-arrays/3-integrate/exercises/utils/add-to-numbers.spec.js b/08-arrays/3-integrate/exercises/utils/add-to-numbers.spec.js similarity index 100% rename from 7-arrays/3-integrate/exercises/utils/add-to-numbers.spec.js rename to 08-arrays/3-integrate/exercises/utils/add-to-numbers.spec.js diff --git a/7-arrays/3-integrate/exercises/utils/filter-by-length.js b/08-arrays/3-integrate/exercises/utils/filter-by-length.js similarity index 100% rename from 7-arrays/3-integrate/exercises/utils/filter-by-length.js rename to 08-arrays/3-integrate/exercises/utils/filter-by-length.js diff --git a/7-arrays/3-integrate/exercises/utils/filter-by-length.spec.js b/08-arrays/3-integrate/exercises/utils/filter-by-length.spec.js similarity index 100% rename from 7-arrays/3-integrate/exercises/utils/filter-by-length.spec.js rename to 08-arrays/3-integrate/exercises/utils/filter-by-length.spec.js diff --git a/7-arrays/3-integrate/exercises/utils/search.js b/08-arrays/3-integrate/exercises/utils/search.js similarity index 100% rename from 7-arrays/3-integrate/exercises/utils/search.js rename to 08-arrays/3-integrate/exercises/utils/search.js diff --git a/7-arrays/3-integrate/exercises/utils/search.spec.js b/08-arrays/3-integrate/exercises/utils/search.spec.js similarity index 100% rename from 7-arrays/3-integrate/exercises/utils/search.spec.js rename to 08-arrays/3-integrate/exercises/utils/search.spec.js diff --git a/08-arrays/3-integrate/study.json b/08-arrays/3-integrate/study.json new file mode 100644 index 0000000..9a9d7c7 --- /dev/null +++ b/08-arrays/3-integrate/study.json @@ -0,0 +1,6 @@ +{ + "study": { + "type": "module", + "environment": true + } +} diff --git a/08-arrays/4-dom-ui/README.md b/08-arrays/4-dom-ui/README.md new file mode 100644 index 0000000..cb83bfa --- /dev/null +++ b/08-arrays/4-dom-ui/README.md @@ -0,0 +1 @@ +# 4. DOM UI diff --git a/08-arrays/4-dom-ui/examples/average/index.html b/08-arrays/4-dom-ui/examples/average/index.html new file mode 100644 index 0000000..3ed502c --- /dev/null +++ b/08-arrays/4-dom-ui/examples/average/index.html @@ -0,0 +1,25 @@ + + + + + +
+ + + +
+ +your output: + + +
+ +expected output: + ++ + + + + + + + + + + diff --git a/08-arrays/4-dom-ui/examples/average/script.js b/08-arrays/4-dom-ui/examples/average/script.js new file mode 100644 index 0000000..0e747f6 --- /dev/null +++ b/08-arrays/4-dom-ui/examples/average/script.js @@ -0,0 +1,42 @@ +import { average } from './utils/average.js'; +import { renderList } from './utils/render-list.js'; + +/* Average + + Displays a list of numbers and their average. + + The average updates dynamically as users add numbers to the list. + +*/ + +// === state === + +const numbers = []; + +// === important DOM elements === + +const numberInputEl = document.getElementById('new-number'); +const addNumberButton = document.getElementById('add-new-number'); + +const displayZoneEl = document.getElementById('display-zone'); + +// === define user interaction === + +const addNumberToList = () => { + // -- read new number and add it to state --- + const newNumber = Number(numberInputEl.value); + numbers.push(newNumber); + + // --- calculate the average of all saved numbers --- + const newAverage = average(numbers); + + // --- render a new message for the user --- + const message = `=> ${newAverage}\n\n${renderList(numbers)}`; + + // --- display the message for the user --- + displayZoneEl.innerText = message; +}; + +// === pass handler to event listener === + +addNumberButton.addEventListener('click', addNumberToList); diff --git a/lesson-plans/group-project-intro/examples/sort-numbers/styles.css b/08-arrays/4-dom-ui/examples/average/styles.css similarity index 100% rename from lesson-plans/group-project-intro/examples/sort-numbers/styles.css rename to 08-arrays/4-dom-ui/examples/average/styles.css diff --git a/lesson-plans/group-project-intro/examples/welcome/styles.css b/08-arrays/4-dom-ui/examples/average/utils/README.md similarity index 100% rename from lesson-plans/group-project-intro/examples/welcome/styles.css rename to 08-arrays/4-dom-ui/examples/average/utils/README.md diff --git a/08-arrays/4-dom-ui/examples/average/utils/average.js b/08-arrays/4-dom-ui/examples/average/utils/average.js new file mode 100644 index 0000000..62dfc6f --- /dev/null +++ b/08-arrays/4-dom-ui/examples/average/utils/average.js @@ -0,0 +1,18 @@ +/** + * Calculates the average of a list of numbers. + * + * @param {number[]} [numbers=[]] - The numbers to average. + * @returns {number} The average of all numbers. + */ +export const average = (numbers = []) => { + if (numbers.length === 0) { + return 0; + } + + let sum = 0; + for (const number of numbers) { + sum += number; + } + + return sum / numbers.length; +}; diff --git a/08-arrays/4-dom-ui/examples/average/utils/average.spec.js b/08-arrays/4-dom-ui/examples/average/utils/average.spec.js new file mode 100644 index 0000000..19e549b --- /dev/null +++ b/08-arrays/4-dom-ui/examples/average/utils/average.spec.js @@ -0,0 +1,33 @@ +import { average } from './average.js'; + +describe('average: calculates the average of an array of numbers', () => { + describe('averaging numbers', () => { + it('returns 0 for an empty array', () => { + const actual = average([]); + expect(actual).toEqual(0); + }); + it('can average a single number', () => { + const actual = average([4]); + expect(actual).toEqual(4); + }); + it('can average many of the same number', () => { + const actual = average([4, 4, 4, 4]); + expect(actual).toEqual(4); + }); + it('can average opposites', () => { + const actual = average([-2, -1, 1, 2]); + expect(actual).toEqual(0); + }); + it('can average a mess of numbers', () => { + const actual = average([200, -2, 4, -10, 0, 1, 0.7, 2]); + expect(actual).toEqual(24.4625); + }); + }); + describe('average is a pure function', () => { + it('does not modify the argument', () => { + const arg = [1, 2, 3]; + average(arg); + expect(arg).toEqual([1, 2, 3]); + }); + }); +}); diff --git a/08-arrays/4-dom-ui/examples/average/utils/render-list.js b/08-arrays/4-dom-ui/examples/average/utils/render-list.js new file mode 100644 index 0000000..4b4df5f --- /dev/null +++ b/08-arrays/4-dom-ui/examples/average/utils/render-list.js @@ -0,0 +1,22 @@ +/** + * Converts an array if items into a string list. + * + * @param {any} [arr=[]] - The items to list. + * @returns {string} A formatted list of items. + * + * @example + * + * listItems([1, 2, 3]); //--> "* 1\n* 2\n* 3\n" + * + * @example + * + * listItems([2, 5, 0, -3]); //--> "* 2\n* 5\n* 0\n* -3\n" + * + */ +export const renderList = (arr = []) => { + let list = ''; + for (const item of arr) { + list += `* ${item}\n`; + } + return list; +}; diff --git a/08-arrays/4-dom-ui/examples/average/utils/render-list.spec.js b/08-arrays/4-dom-ui/examples/average/utils/render-list.spec.js new file mode 100644 index 0000000..2fe2e52 --- /dev/null +++ b/08-arrays/4-dom-ui/examples/average/utils/render-list.spec.js @@ -0,0 +1,25 @@ +import { renderList } from './render-list.js'; + +describe('renderList: converts and array into a string list with `*` bullet points', () => { + describe('creating the list', () => { + it('renders an empty list', () => { + const actual = renderList([]); + expect(actual).toEqual(''); + }); + it('renders a list with one number', () => { + const actual = renderList([12]); + expect(actual).toEqual('* 12\n'); + }); + it('renders a list with many numbers', () => { + const actual = renderList([3, 12, -4, 0]); + expect(actual).toEqual('* 3\n* 12\n* -4\n* 0\n'); + }); + }); + describe('renderList is a pure function', () => { + it('does not modify the argument', () => { + const arg = [1, 2, 3]; + renderList(arg); + expect(arg).toEqual([1, 2, 3]); + }); + }); +}); diff --git a/08-arrays/4-dom-ui/exercises/README.md b/08-arrays/4-dom-ui/exercises/README.md new file mode 100644 index 0000000..33021ca --- /dev/null +++ b/08-arrays/4-dom-ui/exercises/README.md @@ -0,0 +1,3 @@ +# Can you adapt the programs from `../../3-integrate` to use the DOM instead of + +`prompt`/`alert`/`confirm`? diff --git a/08-arrays/README.md b/08-arrays/README.md new file mode 100644 index 0000000..27bd39f --- /dev/null +++ b/08-arrays/README.md @@ -0,0 +1,39 @@ +# Arrays + +## 1. Isolate + +Learn to read, visualize, trace, debug, refactor and write small programs with +arrays and no user interactions. + +You will explore: different ways of _accessing array elements_, _`for-of` +loops_, _reference vs. value_, _copying arrays_ and _side-effects_. + +## 2. Practice + +Practice using arrays and avoiding side-effects by learning to unit test +functions that take arrays as arguments. This includes learning how to test +whether or not a function produces array side effects. + +1. Write tests for functions that take arrays as arguments. +2. Fix bugs in tested functions that take arrays as arguments. +3. Write functions that take arrays as arguments and _do not_ produce + side-effects. + +## 3. Integrate + +Integrate the skills from **Isolate** and **Practice** into larger programs that +use `prompt`/`alert`/`confirm` to interact with the user. You will write and +test your functions in a separate folder, and import them to the main program. + +1. Import and use functions in your program from a separate file. +2. Write functions that are imported and called in a program. +3. Refactor portions of a program to a separate file as a reusable & tested + function. +4. Reverse-engineer programs that use functions declared in a separate file. + +> see [/3-integrate/README.md](./3-integrate/README.md) for more details + +## 4. DOM UI + +Looking for a challenge? Try adapting each program from **Integrate** to use a +DOM UI instead of `prompt`/`alert`/`confirm`. diff --git a/08-arrays/study.json b/08-arrays/study.json new file mode 100644 index 0000000..9919c5d --- /dev/null +++ b/08-arrays/study.json @@ -0,0 +1,10 @@ +{ + "study": { + "flowchart": false, + "loopGuard": false, + "variables": false, + "blanks": false, + "trace": false, + "ask": false + } +} diff --git a/8-functional-array-methods/1-isolate/1-array-strategies/examples/every.js b/09-functional-array-methods/1-isolate/1-array-strategies/examples/every.js similarity index 100% rename from 8-functional-array-methods/1-isolate/1-array-strategies/examples/every.js rename to 09-functional-array-methods/1-isolate/1-array-strategies/examples/every.js diff --git a/8-functional-array-methods/1-isolate/1-array-strategies/examples/filtering.js b/09-functional-array-methods/1-isolate/1-array-strategies/examples/filtering.js similarity index 100% rename from 8-functional-array-methods/1-isolate/1-array-strategies/examples/filtering.js rename to 09-functional-array-methods/1-isolate/1-array-strategies/examples/filtering.js diff --git a/8-functional-array-methods/1-isolate/1-array-strategies/examples/mapping.js b/09-functional-array-methods/1-isolate/1-array-strategies/examples/mapping.js similarity index 100% rename from 8-functional-array-methods/1-isolate/1-array-strategies/examples/mapping.js rename to 09-functional-array-methods/1-isolate/1-array-strategies/examples/mapping.js diff --git a/8-functional-array-methods/1-isolate/1-array-strategies/examples/reducing.js b/09-functional-array-methods/1-isolate/1-array-strategies/examples/reducing.js similarity index 100% rename from 8-functional-array-methods/1-isolate/1-array-strategies/examples/reducing.js rename to 09-functional-array-methods/1-isolate/1-array-strategies/examples/reducing.js diff --git a/09-functional-array-methods/1-isolate/1-array-strategies/examples/study.json b/09-functional-array-methods/1-isolate/1-array-strategies/examples/study.json new file mode 100644 index 0000000..af9dc0d --- /dev/null +++ b/09-functional-array-methods/1-isolate/1-array-strategies/examples/study.json @@ -0,0 +1,5 @@ +{ + "study": { + "openIn": true + } +} diff --git a/8-functional-array-methods/1-isolate/2-callbacks/examples/passing-functions.js b/09-functional-array-methods/1-isolate/2-callbacks/examples/passing-functions.js similarity index 100% rename from 8-functional-array-methods/1-isolate/2-callbacks/examples/passing-functions.js rename to 09-functional-array-methods/1-isolate/2-callbacks/examples/passing-functions.js diff --git a/8-functional-array-methods/1-isolate/2-callbacks/exercises/1-write-callbacks.js b/09-functional-array-methods/1-isolate/2-callbacks/exercises/1-write-callbacks.js similarity index 100% rename from 8-functional-array-methods/1-isolate/2-callbacks/exercises/1-write-callbacks.js rename to 09-functional-array-methods/1-isolate/2-callbacks/exercises/1-write-callbacks.js diff --git a/8-functional-array-methods/1-isolate/2-callbacks/exercises/2-use-callbacks.js b/09-functional-array-methods/1-isolate/2-callbacks/exercises/2-use-callbacks.js similarity index 100% rename from 8-functional-array-methods/1-isolate/2-callbacks/exercises/2-use-callbacks.js rename to 09-functional-array-methods/1-isolate/2-callbacks/exercises/2-use-callbacks.js diff --git a/8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/everying.js b/09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/everying.js similarity index 100% rename from 8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/everying.js rename to 09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/everying.js diff --git a/8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/filtering.js b/09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/filtering.js similarity index 100% rename from 8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/filtering.js rename to 09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/filtering.js diff --git a/8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/finding.js b/09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/finding.js similarity index 100% rename from 8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/finding.js rename to 09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/finding.js diff --git a/8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/mapping.js b/09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/mapping.js similarity index 100% rename from 8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/mapping.js rename to 09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/mapping.js diff --git a/8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/reducing.js b/09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/reducing.js similarity index 100% rename from 8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/reducing.js rename to 09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/reducing.js diff --git a/09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/study.json b/09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/study.json new file mode 100644 index 0000000..af9dc0d --- /dev/null +++ b/09-functional-array-methods/1-isolate/3-higher-order-strategies/examples/study.json @@ -0,0 +1,5 @@ +{ + "study": { + "openIn": true + } +} diff --git a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/1-the-methods.js b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/1-the-methods.js similarity index 100% rename from 8-functional-array-methods/1-isolate/4-functional-array-methods/examples/1-the-methods.js rename to 09-functional-array-methods/1-isolate/4-functional-array-methods/examples/1-the-methods.js diff --git a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/2-separate-callbacks.js b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/2-separate-callbacks.js similarity index 100% rename from 8-functional-array-methods/1-isolate/4-functional-array-methods/examples/2-separate-callbacks.js rename to 09-functional-array-methods/1-isolate/4-functional-array-methods/examples/2-separate-callbacks.js diff --git a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/3-inline-callbacks.js b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/3-inline-callbacks.js similarity index 100% rename from 8-functional-array-methods/1-isolate/4-functional-array-methods/examples/3-inline-callbacks.js rename to 09-functional-array-methods/1-isolate/4-functional-array-methods/examples/3-inline-callbacks.js diff --git a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/every.js b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/every.js similarity index 100% rename from 8-functional-array-methods/1-isolate/4-functional-array-methods/examples/every.js rename to 09-functional-array-methods/1-isolate/4-functional-array-methods/examples/every.js diff --git a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/filter.js b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/filter.js similarity index 100% rename from 8-functional-array-methods/1-isolate/4-functional-array-methods/examples/filter.js rename to 09-functional-array-methods/1-isolate/4-functional-array-methods/examples/filter.js diff --git a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/find.js b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/find.js similarity index 100% rename from 8-functional-array-methods/1-isolate/4-functional-array-methods/examples/find.js rename to 09-functional-array-methods/1-isolate/4-functional-array-methods/examples/find.js diff --git a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/map.js b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/map.js similarity index 100% rename from 8-functional-array-methods/1-isolate/4-functional-array-methods/examples/map.js rename to 09-functional-array-methods/1-isolate/4-functional-array-methods/examples/map.js diff --git a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/reduce.js b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/reduce.js similarity index 100% rename from 8-functional-array-methods/1-isolate/4-functional-array-methods/examples/reduce.js rename to 09-functional-array-methods/1-isolate/4-functional-array-methods/examples/reduce.js diff --git a/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/study.json b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/study.json new file mode 100644 index 0000000..af9dc0d --- /dev/null +++ b/09-functional-array-methods/1-isolate/4-functional-array-methods/examples/study.json @@ -0,0 +1,5 @@ +{ + "study": { + "openIn": true + } +} diff --git a/8-functional-array-methods/1-isolate/README.md b/09-functional-array-methods/1-isolate/README.md similarity index 100% rename from 8-functional-array-methods/1-isolate/README.md rename to 09-functional-array-methods/1-isolate/README.md diff --git a/8-functional-array-methods/1-isolate/map-filter-reduce.png b/09-functional-array-methods/1-isolate/map-filter-reduce.png similarity index 100% rename from 8-functional-array-methods/1-isolate/map-filter-reduce.png rename to 09-functional-array-methods/1-isolate/map-filter-reduce.png diff --git a/09-functional-array-methods/1-isolate/study.json b/09-functional-array-methods/1-isolate/study.json new file mode 100644 index 0000000..e37e9a9 --- /dev/null +++ b/09-functional-array-methods/1-isolate/study.json @@ -0,0 +1,5 @@ +{ + "study": { + "openIn": "jsTutorLive" + } +} diff --git a/8-functional-array-methods/2-practice/README.md b/09-functional-array-methods/2-practice/README.md similarity index 100% rename from 8-functional-array-methods/2-practice/README.md rename to 09-functional-array-methods/2-practice/README.md diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/is-even.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/is-even.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/is-even.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/is-even.js diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/is-even.spec.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/is-even.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/is-even.spec.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/is-even.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/is-excited.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/is-excited.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/is-excited.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/is-excited.js diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/is-excited.spec.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/is-excited.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/is-excited.spec.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/is-excited.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/join-with-comma.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/join-with-comma.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/join-with-comma.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/join-with-comma.js diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/join-with-comma.spec.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/join-with-comma.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/join-with-comma.spec.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/join-with-comma.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/longer-than-five.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/longer-than-five.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/longer-than-five.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/longer-than-five.js diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/longer-than-five.spec.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/longer-than-five.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/longer-than-five.spec.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/longer-than-five.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/reverse-string.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/reverse-string.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/reverse-string.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/reverse-string.js diff --git a/8-functional-array-methods/2-practice/exercises/1-write-callbacks/reverse-string.spec.js b/09-functional-array-methods/2-practice/exercises/1-write-callbacks/reverse-string.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/1-write-callbacks/reverse-string.spec.js rename to 09-functional-array-methods/2-practice/exercises/1-write-callbacks/reverse-string.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/2-use-callbacks/first-negative-number.js b/09-functional-array-methods/2-practice/exercises/2-use-callbacks/first-negative-number.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/2-use-callbacks/first-negative-number.js rename to 09-functional-array-methods/2-practice/exercises/2-use-callbacks/first-negative-number.js diff --git a/8-functional-array-methods/2-practice/exercises/2-use-callbacks/first-negative-number.spec.js b/09-functional-array-methods/2-practice/exercises/2-use-callbacks/first-negative-number.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/2-use-callbacks/first-negative-number.spec.js rename to 09-functional-array-methods/2-practice/exercises/2-use-callbacks/first-negative-number.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/2-use-callbacks/numbery-numberify.js b/09-functional-array-methods/2-practice/exercises/2-use-callbacks/numbery-numberify.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/2-use-callbacks/numbery-numberify.js rename to 09-functional-array-methods/2-practice/exercises/2-use-callbacks/numbery-numberify.js diff --git a/8-functional-array-methods/2-practice/exercises/2-use-callbacks/numbery-numberify.spec.js b/09-functional-array-methods/2-practice/exercises/2-use-callbacks/numbery-numberify.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/2-use-callbacks/numbery-numberify.spec.js rename to 09-functional-array-methods/2-practice/exercises/2-use-callbacks/numbery-numberify.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/2-use-callbacks/sentence-it.js b/09-functional-array-methods/2-practice/exercises/2-use-callbacks/sentence-it.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/2-use-callbacks/sentence-it.js rename to 09-functional-array-methods/2-practice/exercises/2-use-callbacks/sentence-it.js diff --git a/8-functional-array-methods/2-practice/exercises/2-use-callbacks/sentence-it.spec.js b/09-functional-array-methods/2-practice/exercises/2-use-callbacks/sentence-it.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/2-use-callbacks/sentence-it.spec.js rename to 09-functional-array-methods/2-practice/exercises/2-use-callbacks/sentence-it.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery-guide.mp4 b/09-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery-guide.mp4 similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery-guide.mp4 rename to 09-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery-guide.mp4 diff --git a/8-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery.js b/09-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery.js rename to 09-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery.js diff --git a/8-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery.spec.js b/09-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery.spec.js rename to 09-functional-array-methods/2-practice/exercises/2-use-callbacks/sum-numbery.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/all-long.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/all-long.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/all-long.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/all-long.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/all-long.spec.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/all-long.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/all-long.spec.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/all-long.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/concatenate-as-strings.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/concatenate-as-strings.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/concatenate-as-strings.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/concatenate-as-strings.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/concatenate-as-strings.spec.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/concatenate-as-strings.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/concatenate-as-strings.spec.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/concatenate-as-strings.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/contains-no-numbers.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/contains-no-numbers.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/contains-no-numbers.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/contains-no-numbers.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/contains-no-numbers.spec.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/contains-no-numbers.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/contains-no-numbers.spec.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/contains-no-numbers.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/keep-numbery.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/keep-numbery.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/keep-numbery.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/keep-numbery.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/keep-numbery.spec.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/keep-numbery.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/keep-numbery.spec.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/keep-numbery.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/long-to-upper.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/long-to-upper.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/long-to-upper.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/long-to-upper.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/long-to-upper.spec.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/long-to-upper.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/long-to-upper.spec.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/long-to-upper.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/remove-strings.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/remove-strings.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/remove-strings.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/remove-strings.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/remove-strings.spec.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/remove-strings.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/remove-strings.spec.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/remove-strings.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/replace-entry.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/replace-entry.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/replace-entry.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/replace-entry.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/replace-entry.spec.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/replace-entry.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/replace-entry.spec.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/replace-entry.spec.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/reverse-array.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/reverse-array.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/reverse-array.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/reverse-array.js diff --git a/8-functional-array-methods/2-practice/exercises/3-write-functions/reverse-array.spec.js b/09-functional-array-methods/2-practice/exercises/3-write-functions/reverse-array.spec.js similarity index 100% rename from 8-functional-array-methods/2-practice/exercises/3-write-functions/reverse-array.spec.js rename to 09-functional-array-methods/2-practice/exercises/3-write-functions/reverse-array.spec.js diff --git a/09-functional-array-methods/2-practice/study.json b/09-functional-array-methods/2-practice/study.json new file mode 100644 index 0000000..0dbe924 --- /dev/null +++ b/09-functional-array-methods/2-practice/study.json @@ -0,0 +1,9 @@ +{ + "study": { + "openIn": false, + "ask": false, + "trace": false, + "type": "module", + "environment": true + } +} diff --git a/8-functional-array-methods/3-implicit-return/README.md b/09-functional-array-methods/3-implicit-return/README.md similarity index 98% rename from 8-functional-array-methods/3-implicit-return/README.md rename to 09-functional-array-methods/3-implicit-return/README.md index 65470f1..73cc95d 100644 --- a/8-functional-array-methods/3-implicit-return/README.md +++ b/09-functional-array-methods/3-implicit-return/README.md @@ -15,7 +15,7 @@ to that. // these two functions do exactly the same thing! const explicitReturn = (a, b) => { - return a + b; + return a + b; }; const implicitReturn = (a, b) => a + b; diff --git a/8-functional-array-methods/3-implicit-return/examples/add-number.js b/09-functional-array-methods/3-implicit-return/examples/add-number.js similarity index 100% rename from 8-functional-array-methods/3-implicit-return/examples/add-number.js rename to 09-functional-array-methods/3-implicit-return/examples/add-number.js diff --git a/8-functional-array-methods/3-implicit-return/examples/add-number.spec.js b/09-functional-array-methods/3-implicit-return/examples/add-number.spec.js similarity index 100% rename from 8-functional-array-methods/3-implicit-return/examples/add-number.spec.js rename to 09-functional-array-methods/3-implicit-return/examples/add-number.spec.js diff --git a/8-functional-array-methods/3-implicit-return/exercises/keep-type.js b/09-functional-array-methods/3-implicit-return/exercises/keep-type.js similarity index 100% rename from 8-functional-array-methods/3-implicit-return/exercises/keep-type.js rename to 09-functional-array-methods/3-implicit-return/exercises/keep-type.js diff --git a/8-functional-array-methods/3-implicit-return/exercises/keep-type.spec.js b/09-functional-array-methods/3-implicit-return/exercises/keep-type.spec.js similarity index 100% rename from 8-functional-array-methods/3-implicit-return/exercises/keep-type.spec.js rename to 09-functional-array-methods/3-implicit-return/exercises/keep-type.spec.js diff --git a/09-functional-array-methods/3-implicit-return/study.json b/09-functional-array-methods/3-implicit-return/study.json new file mode 100644 index 0000000..1d86a65 --- /dev/null +++ b/09-functional-array-methods/3-implicit-return/study.json @@ -0,0 +1,5 @@ +{ + "study": { + "type": "module" + } +} diff --git a/8-functional-array-methods/4-integrate/README.md b/09-functional-array-methods/4-integrate/README.md similarity index 100% rename from 8-functional-array-methods/4-integrate/README.md rename to 09-functional-array-methods/4-integrate/README.md diff --git a/09-functional-array-methods/5-dom-ui/README.md b/09-functional-array-methods/5-dom-ui/README.md new file mode 100644 index 0000000..88294bd --- /dev/null +++ b/09-functional-array-methods/5-dom-ui/README.md @@ -0,0 +1,8 @@ +# DOM UI + +Nothing new here! + +If you want to practice using functional array methods behind a DOM UI you can +either go back to the exercises from the **Arrays** chapter and try rewriting +everything to use array methods instead of loops, or try writing your own +programs. diff --git a/09-functional-array-methods/README.md b/09-functional-array-methods/README.md new file mode 100644 index 0000000..3d9d35d --- /dev/null +++ b/09-functional-array-methods/README.md @@ -0,0 +1,44 @@ +# Functional Array Methods + +Learn how to use functional array methods in JavaScript to easily implement +common problem solving strategies and avoid side effects. + +## 1. Isolate + +Explore different concepts necessary to understand functional array methods, +without any user interactions: + +1. **Array Strategies**: Functional array methods like `.map` and `.filter` are + just one implementation of common problem-solving strategies. Take some time + to learn the strategies with _imperative programming_ before moving on to + function array methods. +2. **Callbacks**: Briefly explore how to pass functions as arguments, and how to + call function arguments. +3. **Higher-Order Strategies**: Merge **Array Strategies** and **Callback** by + exploring example functions that implement common problem solving strategies + using callbacks. +4. **Functional Array Methods**: Finally! Study some examples that use + functional array methods to solve simple problems. + +## 2. Practice + +Pass unit tests using functional array methods: + +1. Write callbacks +2. Use callbacks +3. Write functions + +## 3. Implicit Return + +Briefly practice using arrow functions with _implicit returns_ when the function +body contains only one expression. + +## 4. Integrate + +Integrate your skills by refactoring your solutions from the **Arrays** chapter +to use functional array methods. + +## 5. DOM UI + +Challenge yourself by reimplementing previous array-based programs with a DOM +UI. diff --git a/1-primitives-and-operators/1-primitive-types/study.json b/1-primitives-and-operators/1-primitive-types/study.json deleted file mode 100644 index 38035ae..0000000 --- a/1-primitives-and-operators/1-primitive-types/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "study": { - "trace": { - "variablesDeclare": false, - "variablesAssign": false, - "variablesRead": false - } - } -} diff --git a/1-primitives-and-operators/2-explicit-coercion/study.json b/1-primitives-and-operators/2-explicit-coercion/study.json deleted file mode 100644 index c12065b..0000000 --- a/1-primitives-and-operators/2-explicit-coercion/study.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "study": { - "trace": { - "console": false, - "operators": false, - "variablesDeclare": false, - "variablesAssign": false, - "variablesRead": false - } - } -} diff --git a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/study.json b/1-primitives-and-operators/3-common-operators/1-truthiness-operators/study.json deleted file mode 100644 index 38035ae..0000000 --- a/1-primitives-and-operators/3-common-operators/1-truthiness-operators/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "study": { - "trace": { - "variablesDeclare": false, - "variablesAssign": false, - "variablesRead": false - } - } -} diff --git a/1-primitives-and-operators/3-common-operators/2-comparisons/study.json b/1-primitives-and-operators/3-common-operators/2-comparisons/study.json deleted file mode 100644 index 38035ae..0000000 --- a/1-primitives-and-operators/3-common-operators/2-comparisons/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "study": { - "trace": { - "variablesDeclare": false, - "variablesAssign": false, - "variablesRead": false - } - } -} diff --git a/1-primitives-and-operators/3-common-operators/3-arithmetic/study.json b/1-primitives-and-operators/3-common-operators/3-arithmetic/study.json deleted file mode 100644 index 38035ae..0000000 --- a/1-primitives-and-operators/3-common-operators/3-arithmetic/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "study": { - "trace": { - "variablesDeclare": false, - "variablesAssign": false, - "variablesRead": false - } - } -} diff --git a/1-primitives-and-operators/3-common-operators/study.json b/1-primitives-and-operators/3-common-operators/study.json deleted file mode 100644 index 8373169..0000000 --- a/1-primitives-and-operators/3-common-operators/study.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "study": { - "openIn": "jsTutorLive", - "ask": false - } -} diff --git a/1-primitives-and-operators/4-operator-precedence/study.json b/1-primitives-and-operators/4-operator-precedence/study.json deleted file mode 100644 index 1378973..0000000 --- a/1-primitives-and-operators/4-operator-precedence/study.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "study": { - "table": "operators", - "ask": false, - "variables": false, - "flowchart": false - } -} diff --git a/1-primitives-and-operators/5-increment-decrement/study.json b/1-primitives-and-operators/5-increment-decrement/study.json deleted file mode 100644 index 5cc5df1..0000000 --- a/1-primitives-and-operators/5-increment-decrement/study.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "study": { - "trace": false - } -} diff --git a/1-primitives-and-operators/study.json b/1-primitives-and-operators/study.json deleted file mode 100644 index 4ae30d8..0000000 --- a/1-primitives-and-operators/study.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "study": { - "eslint": false - } -} diff --git a/9-multiple-interactions/1-isolate/1-objects/1-key-value-pairs.js b/10-multiple-interactions/1-isolate/1-objects/1-key-value-pairs.js similarity index 100% rename from 9-multiple-interactions/1-isolate/1-objects/1-key-value-pairs.js rename to 10-multiple-interactions/1-isolate/1-objects/1-key-value-pairs.js diff --git a/9-multiple-interactions/1-isolate/1-objects/2-key-in-object.js b/10-multiple-interactions/1-isolate/1-objects/2-key-in-object.js similarity index 100% rename from 9-multiple-interactions/1-isolate/1-objects/2-key-in-object.js rename to 10-multiple-interactions/1-isolate/1-objects/2-key-in-object.js diff --git a/9-multiple-interactions/1-isolate/1-objects/3-dots-vs-brackets-access.js b/10-multiple-interactions/1-isolate/1-objects/3-dots-vs-brackets-access.js similarity index 100% rename from 9-multiple-interactions/1-isolate/1-objects/3-dots-vs-brackets-access.js rename to 10-multiple-interactions/1-isolate/1-objects/3-dots-vs-brackets-access.js diff --git a/9-multiple-interactions/1-isolate/1-objects/4-es6-shorthand.js b/10-multiple-interactions/1-isolate/1-objects/4-es6-shorthand.js similarity index 100% rename from 9-multiple-interactions/1-isolate/1-objects/4-es6-shorthand.js rename to 10-multiple-interactions/1-isolate/1-objects/4-es6-shorthand.js diff --git a/9-multiple-interactions/1-isolate/1-objects/5-computed-property-names.js b/10-multiple-interactions/1-isolate/1-objects/5-computed-property-names.js similarity index 100% rename from 9-multiple-interactions/1-isolate/1-objects/5-computed-property-names.js rename to 10-multiple-interactions/1-isolate/1-objects/5-computed-property-names.js diff --git a/9-multiple-interactions/1-isolate/1-objects/6-all-ways-to-assign.js b/10-multiple-interactions/1-isolate/1-objects/6-all-ways-to-assign.js similarity index 100% rename from 9-multiple-interactions/1-isolate/1-objects/6-all-ways-to-assign.js rename to 10-multiple-interactions/1-isolate/1-objects/6-all-ways-to-assign.js diff --git a/9-multiple-interactions/1-isolate/1-objects/7-all-the-ways-to-read.js b/10-multiple-interactions/1-isolate/1-objects/7-all-the-ways-to-read.js similarity index 100% rename from 9-multiple-interactions/1-isolate/1-objects/7-all-the-ways-to-read.js rename to 10-multiple-interactions/1-isolate/1-objects/7-all-the-ways-to-read.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/examples/1-shared-reference.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/examples/1-shared-reference.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/examples/1-shared-reference.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/examples/1-shared-reference.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/examples/2-const-with-reference.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/examples/2-const-with-reference.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/examples/2-const-with-reference.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/examples/2-const-with-reference.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/examples/3-comparing.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/examples/3-comparing.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/examples/3-comparing.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/examples/3-comparing.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/examples/4-deep-comparing.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/examples/4-deep-comparing.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/examples/4-deep-comparing.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/examples/4-deep-comparing.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/examples/z-circular-references.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/examples/z-circular-references.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/examples/z-circular-references.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/examples/z-circular-references.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/1-fill-in-blanks.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/1-fill-in-blanks.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/1-fill-in-blanks.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/1-fill-in-blanks.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/2-fill-in-blanks.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/2-fill-in-blanks.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/2-fill-in-blanks.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/2-fill-in-blanks.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/3-fill-in-blanks.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/3-fill-in-blanks.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/3-fill-in-blanks.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/3-fill-in-blanks.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/swap-objects.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/swap-objects.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/swap-objects.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/swap-objects.js diff --git a/9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/swap-properties.js b/10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/swap-properties.js similarity index 100% rename from 9-multiple-interactions/1-isolate/2-reference-vs-value/exercises/swap-properties.js rename to 10-multiple-interactions/1-isolate/2-reference-vs-value/exercises/swap-properties.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/data.js b/10-multiple-interactions/2-dom-ui/examples/data-object/data.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/data.js rename to 10-multiple-interactions/2-dom-ui/examples/data-object/data.js diff --git a/10-multiple-interactions/2-dom-ui/examples/data-object/index.html b/10-multiple-interactions/2-dom-ui/examples/data-object/index.html new file mode 100644 index 0000000..d03f741 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/data-object/index.html @@ -0,0 +1,37 @@ + + + + + ++ + ++ +
+ + +sort numbers (2 interaction scripts) + + + + + ++ + + + + + + + + + + + + diff --git a/10-multiple-interactions/2-dom-ui/examples/data-object/src/add-number.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/add-number.js new file mode 100644 index 0000000..fca1e31 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/data-object/src/add-number.js @@ -0,0 +1,31 @@ +// import program data + +import { data } from '../data.js'; + +// import helper functions + +import { listItems } from './utils/list-items.js'; + +// once when the page is loaded +debugger; + +const addNumber = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const newNumber = Number(document.getElementById('the-num').value); + + // --- update shared data --- + + data.numbers.push(newNumber); + + // --- use shared data to update the UI --- + + const numbersList = listItems(data.numbers); + document.getElementById('all-numbers').innerText = numbersList; +}; + +// tell the browser to call your function each time the user interacts +document.getElementById('add-it').addEventListener('click', addNumber); diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/init.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/init.js similarity index 62% rename from lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/init.js rename to 10-multiple-interactions/2-dom-ui/examples/data-object/src/init.js index 5b162b7..350037a 100644 --- a/lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/init.js +++ b/10-multiple-interactions/2-dom-ui/examples/data-object/src/init.js @@ -4,12 +4,10 @@ import { data } from '../data.js'; // import helper functions -import { display } from '../../../../../../lib/dom-io.js'; - import { listItems } from './utils/list-items.js'; // === initialize the UI === debugger; -display('all-numbers', listItems(data.numbers)); +document.getElementById('all-numbers').innerText = listItems(data.numbers); diff --git a/10-multiple-interactions/2-dom-ui/examples/data-object/src/remove-number.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/remove-number.js new file mode 100644 index 0000000..e75ad04 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/data-object/src/remove-number.js @@ -0,0 +1,32 @@ +// import program data + +import { data } from '../data.js'; + +// import helper functions + +import { remove } from './utils/remove.js'; +import { listItems } from './utils/list-items.js'; + +// once when the page is loaded +debugger; + +const removeNumber = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const toRemove = Number(document.getElementById('the-num').value); + + // --- create a new array and save it in the shared object (side-effect) --- + + data.numbers = remove(data.numbers, toRemove); + + // --- use shared data to update the UI --- + + const numbersList = listItems(data.numbers); + document.getElementById('all-numbers').innerText = numbersList; +}; + +// tell the browser to call your function each time the user interacts +document.getElementById('remove-it').addEventListener('click', removeNumber); diff --git a/10-multiple-interactions/2-dom-ui/examples/data-object/src/sort-numbers.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/sort-numbers.js new file mode 100644 index 0000000..16ae759 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/data-object/src/sort-numbers.js @@ -0,0 +1,40 @@ +// import program data + +import { data } from '../data.js'; + +// import helper functions + +import { listItems } from './utils/list-items.js'; +import { sort } from './utils/sort.js'; + +// once when the page is loaded +debugger; + +const sortNumbers = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const sortType = document.getElementById('sort-type').value; + + // --- read stored data to create a sorted list --- + // you do not need to save the sorted data + + let sortedNumbers; + if (sortType === 'none') { + sortedNumbers = numbers; + } else if (sortType === 'up') { + sortedNumbers = sort(data.numbers, true); + } else if (sortType === 'down') { + sortedNumbers = sort(data.numbers, false); + } + + // --- use shared data to update the UI --- + + const numbersList = listItems(sortedNumbers); + document.getElementById('all-numbers').innerText = numbersList; +}; + +// tell the browser to call your function each time the user interacts +document.getElementById('sort-type').addEventListener('change', sortNumbers); diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/src/utils/list-items.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/list-items.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/src/utils/list-items.js rename to 10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/list-items.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/src/utils/list-items.spec.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/list-items.spec.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/src/utils/list-items.spec.js rename to 10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/list-items.spec.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/remove.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/remove.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/remove.js rename to 10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/remove.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/remove.spec.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/remove.spec.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/remove.spec.js rename to 10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/remove.spec.js diff --git a/lesson-plans/group-project-intro/examples/sort-numbers/src/utils/sort.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/sort.js similarity index 100% rename from lesson-plans/group-project-intro/examples/sort-numbers/src/utils/sort.js rename to 10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/sort.js diff --git a/lesson-plans/group-project-intro/examples/sort-numbers/src/utils/sort.spec.js b/10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/sort.spec.js similarity index 100% rename from lesson-plans/group-project-intro/examples/sort-numbers/src/utils/sort.spec.js rename to 10-multiple-interactions/2-dom-ui/examples/data-object/src/utils/sort.spec.js diff --git a/lesson-plans/util-functions/1-primitives/examples/reverse-something/styles.css b/10-multiple-interactions/2-dom-ui/examples/data-object/styles.css similarity index 100% rename from lesson-plans/util-functions/1-primitives/examples/reverse-something/styles.css rename to 10-multiple-interactions/2-dom-ui/examples/data-object/styles.css diff --git a/10-multiple-interactions/2-dom-ui/examples/interaction-script/data.js b/10-multiple-interactions/2-dom-ui/examples/interaction-script/data.js new file mode 100644 index 0000000..54f7ab2 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/interaction-script/data.js @@ -0,0 +1,2 @@ +// ! side effects ! +export const numbers = [0, 1, -1, 2, -2, 3, -3]; diff --git a/10-multiple-interactions/2-dom-ui/examples/interaction-script/index.html b/10-multiple-interactions/2-dom-ui/examples/interaction-script/index.html new file mode 100644 index 0000000..18b2ea8 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/interaction-script/index.html @@ -0,0 +1,28 @@ + + + + + +
+ +sort the numbers:
+ + +
+ + +sort numbers (1 interaction script) + + + + + ++ + + + + + diff --git a/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/init.js b/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/init.js new file mode 100644 index 0000000..9d2476c --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/init.js @@ -0,0 +1,7 @@ +import { numbers } from '../data.js'; + +import { listItems } from './utils/list-items.js'; + +// === initialize the UI === + +document.getElementById('all-numbers').innerText = listItems(numbers); diff --git a/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/sort-numbers.js b/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/sort-numbers.js new file mode 100644 index 0000000..b046bdd --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/sort-numbers.js @@ -0,0 +1,33 @@ +import { numbers } from '../data.js'; + +import { sort } from './utils/sort.js'; +import { listItems } from './utils/list-items.js'; + +// === set up the user interaction === + +const sortNumbers = () => { + debugger; + + // --- read user input --- + + const sortType = document.getElementById('sort-type').value; + + // --- read stored data to create a sorted list --- + + let sortedNumbers; + if (sortType === 'none') { + sortedNumbers = numbers; + } else if (sortType === 'up') { + sortedNumbers = sort(numbers, true); + } else if (sortType === 'down') { + sortedNumbers = sort(numbers, false); + } + + // --- use shared data to update the UI --- + + const numbersList = listItems(sortedNumbers); + document.getElementById('all-numbers').innerText = numbersList; +}; + +// tell the browser to call your function each time the user interacts +document.getElementById('sort-type').addEventListener('change', sortNumbers); diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/utils/list-items.js b/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/utils/list-items.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/utils/list-items.js rename to 10-multiple-interactions/2-dom-ui/examples/interaction-script/src/utils/list-items.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/utils/list-items.spec.js b/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/utils/list-items.spec.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/utils/list-items.spec.js rename to 10-multiple-interactions/2-dom-ui/examples/interaction-script/src/utils/list-items.spec.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/src/utils/sort.js b/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/utils/sort.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/src/utils/sort.js rename to 10-multiple-interactions/2-dom-ui/examples/interaction-script/src/utils/sort.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/src/utils/sort.spec.js b/10-multiple-interactions/2-dom-ui/examples/interaction-script/src/utils/sort.spec.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/src/utils/sort.spec.js rename to 10-multiple-interactions/2-dom-ui/examples/interaction-script/src/utils/sort.spec.js diff --git a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/styles.css b/10-multiple-interactions/2-dom-ui/examples/interaction-script/styles.css similarity index 100% rename from lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/styles.css rename to 10-multiple-interactions/2-dom-ui/examples/interaction-script/styles.css diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/constants.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/constants.js new file mode 100644 index 0000000..5a6a7f9 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/constants.js @@ -0,0 +1 @@ +export const LIST_THING = '*'; diff --git a/lesson-plans/group-project-intro/examples/sort-numbers/data.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/data.js similarity index 100% rename from lesson-plans/group-project-intro/examples/sort-numbers/data.js rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/data.js diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/index.html b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/index.html new file mode 100644 index 0000000..a0898c8 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/index.html @@ -0,0 +1,34 @@ + + + + + +sort the numbers:
+ + +
+ + +sort numbers 1 + + + + + ++ + + + + + + + + + diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/add-number.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/add-number.js new file mode 100644 index 0000000..23d90c1 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/add-number.js @@ -0,0 +1,31 @@ +import { LIST_THING } from '../constants.js'; + +import { data } from '../data.js'; + +import { renderList } from './utils/render-list.js'; + +// once when the page is loaded +debugger; + +// --- declare callback --- +const addNumber = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const newNumber = Number(document.getElementById('the-num').value); + + // --- update shared data --- + + data.numbers.push(newNumber); + + // --- use shared data to update the UI --- + + const numbersList = renderList(data.numbers, LIST_THING); + document.getElementById('all-numbers').innerText = numbersList; +}; + +// --- pass the callback --- +// tell the browser to call your function each time the user interacts +document.getElementById('add-it').addEventListener('click', addNumber); diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/sort-numbers.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/sort-numbers.js new file mode 100644 index 0000000..0f2801a --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/sort-numbers.js @@ -0,0 +1,35 @@ +import { LIST_THING } from '../constants.js'; + +import { data } from '../data.js'; + +import { renderList } from './utils/render-list.js'; +import { sort } from './utils/sort.js'; + +// once when the page is loaded +debugger; + +const sortNumbers = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const sortType = document.getElementById('sort-type').value; + + // --- read stored data to create a sorted list --- + + const sortedNumbers = + sortType === 'none' + ? data.numbers + : sortType === 'up' + ? sort(data.numbers, true) + : sort(data.numbers, false); + + // --- use shared data to update the UI --- + + const numbersList = renderList(sortedNumbers, LIST_THING); + document.getElementById('all-numbers').innerText = numbersList; +}; + +// tell the browser to call your function each time the user interacts +document.getElementById('sort-type').addEventListener('change', sortNumbers); diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/render-list.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/render-list.js new file mode 100644 index 0000000..d52b741 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/render-list.js @@ -0,0 +1,10 @@ +/** + * + */ +export const renderList = (things = [], bullet = '-') => { + let list = ''; + for (const thing of things) { + list += `${bullet} ${thing}\n`; + } + return list; +}; diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/render-list.spec.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/render-list.spec.js new file mode 100644 index 0000000..7d32de5 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/render-list.spec.js @@ -0,0 +1 @@ +// write me! diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/sort.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/sort.js new file mode 100644 index 0000000..2a8e5da --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/sort.js @@ -0,0 +1,18 @@ +/** + * + */ +export const sort = (numbers = [], up = true) => { + // create a new array to avoid side-effects + const numbersCopy = [...numbers]; + + // sort the new array by side-effect + numbersCopy.sort((a, b) => a - b); + + // reverse the new array if requested + if (!up) { + numbersCopy.reverse(); + } + + // return sorted numbers + return numbersCopy; +}; diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/utils/sort.spec.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/sort.spec.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/utils/sort.spec.js rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/src/utils/sort.spec.js diff --git a/lesson-plans/util-functions/1-primitives/exercises/3-refactor-function/reverse-something/styles.css b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/styles.css similarity index 100% rename from lesson-plans/util-functions/1-primitives/exercises/3-refactor-function/reverse-something/styles.css rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-1/styles.css diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/index.html b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/index.html new file mode 100644 index 0000000..53778cf --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/index.html @@ -0,0 +1,37 @@ + + + + + +
+ +sort the numbers:
+ + +
+ + +sort numbers 2 + + + + + ++ + + + + + + + + + + + + diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/numbers.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/numbers.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/numbers.js rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/numbers.js diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/add-number.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/add-number.js new file mode 100644 index 0000000..c54cb3b --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/add-number.js @@ -0,0 +1,31 @@ +// import program data + +import { numbers } from '../numbers.js'; + +// import helper functions + +import { listItems } from './utils/list-items.js'; + +// once when the page is loaded +debugger; + +const addNumber = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const newNumber = Number(document.getElementById('the-num').value); + + // --- update shared data --- + + numbers.push(newNumber); + + // --- use shared data to update the UI --- + + const numbersList = listItems(numbers); + document.getElementById('all-numbers').innerText = numbersList; +}; + +// tell the browser to call your function each time the user interacts +document.getElementById('add-it').addEventListener('click', addNumber); diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/init.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/init.js similarity index 64% rename from lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/init.js rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/init.js index 0703f9f..1b6eb61 100644 --- a/lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/init.js +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/init.js @@ -4,12 +4,10 @@ import { numbers } from '../numbers.js'; // import helper functions -import { display } from '../../../../../../lib/dom-io.js'; - import { listItems } from './utils/list-items.js'; // === initialize the UI === debugger; -display('all-numbers', listItems(numbers)); +document.getElementById('all-numbers').innerText = listItems(numbers); diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/remove-number.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/remove-number.js new file mode 100644 index 0000000..cbb6e53 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/remove-number.js @@ -0,0 +1,37 @@ +// import program data + +import { numbers } from '../numbers.js'; + +// import helper functions + +import { listItems } from './utils/list-items.js'; + +// once when the page is loaded +debugger; + +const removeNumber = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const toRemove = Number(document.getElementById('the-num').value); + + // --- update shared data by side-effect --- + + for (let i = 0; i < numbers.length; i++) { + const number = numbers[i]; + if (number === toRemove) { + numbers.splice(i, i + 1); + i--; + } + } + + // --- use shared data to update the UI --- + + const numbersList = listItems(numbers); + document.getElementById('all-numbers').innerText = numbersList; +}; + +// tell the browser to call your function each time the user interacts +document.getElementById('remove-it').addEventListener('click', removeNumber); diff --git a/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/sort-numbers.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/sort-numbers.js new file mode 100644 index 0000000..cdd1137 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/sort-numbers.js @@ -0,0 +1,41 @@ +// import program data + +import { numbers } from '../numbers.js'; + +// import helper functions + +import { listItems } from './utils/list-items.js'; +import { sort } from './utils/sort.js'; + +// once when the page is loaded +debugger; + +const sortNumbers = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const sortType = document.getElementById('sort-type').value; + + // --- read stored data to create a sorted list --- + // you do not need to save the sorted data + + let sortedNumbers; + if (sortType === 'none') { + sortedNumbers = numbers; + } else if (sortType === 'up') { + sortedNumbers = sort(numbers, true); + } else if (sortType === 'down') { + sortedNumbers = sort(numbers, false); + } + + // --- use shared data to update the UI --- + + const numbersList = listItems(sortedNumbers); + + document.getElementById('all-numbers').innerText = numbersList; +}; + +// tell the browser to call your function each time the user interacts +document.getElementById('sort-type').addEventListener('change', sortNumbers); diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/list-items.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/utils/list-items.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/list-items.js rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/utils/list-items.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/list-items.spec.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/utils/list-items.spec.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/list-items.spec.js rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/utils/list-items.spec.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/utils/sort.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/utils/sort.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/src/utils/sort.js rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/utils/sort.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/sort.spec.js b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/utils/sort.spec.js similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/3-data-object/src/utils/sort.spec.js rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/src/utils/sort.spec.js diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/styles.css b/10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/styles.css similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/1-interaction-script/styles.css rename to 10-multiple-interactions/2-dom-ui/examples/sort-numbers-2/styles.css diff --git a/10-multiple-interactions/2-dom-ui/examples/welcome/constants.js b/10-multiple-interactions/2-dom-ui/examples/welcome/constants.js new file mode 100644 index 0000000..5dc4ca0 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/welcome/constants.js @@ -0,0 +1 @@ +export const GREETING = 'Welcome'; diff --git a/lesson-plans/group-project-intro/examples/welcome/data.js b/10-multiple-interactions/2-dom-ui/examples/welcome/data.js similarity index 100% rename from lesson-plans/group-project-intro/examples/welcome/data.js rename to 10-multiple-interactions/2-dom-ui/examples/welcome/data.js diff --git a/10-multiple-interactions/2-dom-ui/examples/welcome/index.html b/10-multiple-interactions/2-dom-ui/examples/welcome/index.html new file mode 100644 index 0000000..6230ee1 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/welcome/index.html @@ -0,0 +1,27 @@ + + + + + +
+ +sort the numbers:
+ + +
+ + +welcome + + + + + ++ first: + + + + + + + diff --git a/10-multiple-interactions/2-dom-ui/examples/welcome/src/change-first.js b/10-multiple-interactions/2-dom-ui/examples/welcome/src/change-first.js new file mode 100644 index 0000000..743d776 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/welcome/src/change-first.js @@ -0,0 +1,32 @@ +import { GREETING } from '../constants.js'; + +import { data } from '../data.js'; + +import { greet } from './utils/greet.js'; + +// once when the page is loaded +debugger; + +// --- declare callback --- +const changeFirst = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const newFirst = document.getElementById('first-name').value; + + // --- update shared data --- + + data.first = newFirst; + + // --- use shared data to update the UI --- + + const newGreeting = greet(GREETING, data.first, data.last); + + document.getElementById('greeting').innerText = newGreeting; +}; + +// --- pass callback --- +// tell the browser to call your function each time the user interacts +document.getElementById('first-name').addEventListener('input', changeFirst); diff --git a/10-multiple-interactions/2-dom-ui/examples/welcome/src/change-last.js b/10-multiple-interactions/2-dom-ui/examples/welcome/src/change-last.js new file mode 100644 index 0000000..bb7797d --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/welcome/src/change-last.js @@ -0,0 +1,30 @@ +import { GREETING } from '../constants.js'; + +import { data } from '../data.js'; + +import { greet } from './utils/greet.js'; + +// once when the page is loaded +debugger; + +const changeLast = () => { + // each time the user does this + debugger; + + // --- read user input --- + + const newLast = document.getElementById('last-name').value; + + // --- update shared data --- + + data.last = newLast; + + // --- use shared data to update the UI --- + + const newGreeting = greet(GREETING, data.first, data.last); + + document.getElementById('greeting').innerText = newGreeting; +}; + +// tell the browser to call your function each time the user interacts +document.getElementById('last-name').addEventListener('input', changeLast); diff --git a/10-multiple-interactions/2-dom-ui/examples/welcome/src/utils/greet.js b/10-multiple-interactions/2-dom-ui/examples/welcome/src/utils/greet.js new file mode 100644 index 0000000..c4b15c4 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/welcome/src/utils/greet.js @@ -0,0 +1,20 @@ +/** + * + */ +export const greet = (greeting = '', first = '', last = '') => { + // create the empty greeting + let newMessage = greeting; + + // render the first name if one was passed + if (first !== '') { + newMessage += ' ' + first; + } + + // render the last name if one was passed + if (last !== '') { + newMessage += ' ' + last; + } + + // return an excited greeting + return newMessage + '!'; +}; diff --git a/10-multiple-interactions/2-dom-ui/examples/welcome/src/utils/greet.spec.js b/10-multiple-interactions/2-dom-ui/examples/welcome/src/utils/greet.spec.js new file mode 100644 index 0000000..23199d7 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/examples/welcome/src/utils/greet.spec.js @@ -0,0 +1,18 @@ +import { greet } from './greet.js'; + +describe('greet: creates a greeting from a first and last name', () => { + it('says "Welcome!" when no names are passed', () => { + expect(greet('Welcome', '', '')).toEqual('Welcome!'); + }); + it('says "Welcome
+ + last: + +
+ +Welcome!
+!" when only a first name is passed', () => { + expect(greet('Hi', 'Java', '')).toEqual('Hi Java!'); + }); + it('says "Welcome !" when only a last name is passed', () => { + expect(greet('Leave me alone', '', 'Script')).toEqual( + 'Leave me alone Script!', + ); + }); + it('says "Welcome !" when both names are passed', () => { + expect(greet('Howdy', 'Java', 'Script')).toEqual('Howdy Java Script!'); + }); +}); diff --git a/lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/styles.css b/10-multiple-interactions/2-dom-ui/examples/welcome/styles.css similarity index 100% rename from lesson-plans/util-functions/2-array-and-object/exercises/2-interaction-scripts/styles.css rename to 10-multiple-interactions/2-dom-ui/examples/welcome/styles.css diff --git a/10-multiple-interactions/2-dom-ui/exercises/README.md b/10-multiple-interactions/2-dom-ui/exercises/README.md new file mode 100644 index 0000000..1c94be5 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/exercises/README.md @@ -0,0 +1,4 @@ +# Multiple Interactions: Exercises + +You're on your own! Study the examples to understand how program state and +constants can be stored in separate files, then let your imagination run wild. diff --git a/10-multiple-interactions/2-dom-ui/study.json b/10-multiple-interactions/2-dom-ui/study.json new file mode 100644 index 0000000..e3e8273 --- /dev/null +++ b/10-multiple-interactions/2-dom-ui/study.json @@ -0,0 +1,10 @@ +{ + "study": { + "trace": false, + "ask": false, + "eslint": false, + "flowchart": false, + "variables": false, + "blanks": false + } +} diff --git a/10-multiple-interactions/README.md b/10-multiple-interactions/README.md new file mode 100644 index 0000000..02e488b --- /dev/null +++ b/10-multiple-interactions/README.md @@ -0,0 +1,20 @@ +# Multiple Interactions + +Learn how to structure your code when a program has more than one user +interaction accessing the same state. + +## 1. Isolate + +Learn how to use the JavaScript object data structure including: _access by +dot_, _access by brackets_, _ES6 shorthand_, _computed property names_, and how +to avoid side-effects when working with objects. + +## 2. DOM UI + +Study a few examples of programs that store their data in objects, and support +multiple user interactions with the same data. Pay special attention to: + +- How the code is organized into separate files and folders. +- How side-effects are avoided when arrays are stored in objects. + +Then go wild! What programs can you imagine building? diff --git a/2-control-flow/1-isolate/1-conditional-statements/study.json b/2-control-flow/1-isolate/1-conditional-statements/study.json deleted file mode 100644 index 44b150d..0000000 --- a/2-control-flow/1-isolate/1-conditional-statements/study.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "study": { - "flowchart": true - } -} diff --git a/2-control-flow/1-isolate/6-for-loops/exercises/1-parsons/study.json b/2-control-flow/1-isolate/6-for-loops/exercises/1-parsons/study.json deleted file mode 100644 index 474c918..0000000 --- a/2-control-flow/1-isolate/6-for-loops/exercises/1-parsons/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "--defaults": { - ".js": "parsons" - }, - "parsons": { - "run": true, - "trace": true - } -} diff --git a/2-control-flow/1-isolate/study.json b/2-control-flow/1-isolate/study.json deleted file mode 100644 index 8373169..0000000 --- a/2-control-flow/1-isolate/study.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "study": { - "openIn": "jsTutorLive", - "ask": false - } -} diff --git a/2-control-flow/2-integrate/0-prompt-alert-confirm/study.json b/2-control-flow/2-integrate/0-prompt-alert-confirm/study.json deleted file mode 100644 index 1eb93a1..0000000 --- a/2-control-flow/2-integrate/0-prompt-alert-confirm/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "study": { - "flowchart": true, - "loopGuard": { - "active": true, - "max": 20 - } - } -} diff --git a/2-control-flow/2-integrate/study.json b/2-control-flow/2-integrate/study.json deleted file mode 100644 index 1eb93a1..0000000 --- a/2-control-flow/2-integrate/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "study": { - "flowchart": true, - "loopGuard": { - "active": true, - "max": 20 - } - } -} diff --git a/2-control-flow/3-dom-ui/multiplication/index.html b/2-control-flow/3-dom-ui/multiplication/index.html deleted file mode 100644 index 742e068..0000000 --- a/2-control-flow/3-dom-ui/multiplication/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - multiplication - - - - - -- - X - - - - - - diff --git a/2-control-flow/3-dom-ui/multiplication/script.js b/2-control-flow/3-dom-ui/multiplication/script.js deleted file mode 100644 index 158f6fd..0000000 --- a/2-control-flow/3-dom-ui/multiplication/script.js +++ /dev/null @@ -1,11 +0,0 @@ -import { readNumber, display } from '../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user values - - // use a for loop to multiply the two numbers - - // display the product -}); diff --git a/2-control-flow/3-dom-ui/multiplication/script.re.js b/2-control-flow/3-dom-ui/multiplication/script.re.js deleted file mode 100644 index 539a25f..0000000 --- a/2-control-flow/3-dom-ui/multiplication/script.re.js +++ /dev/null @@ -1,87 +0,0 @@ -const _0x22f7f9 = _0x21dc; -function _0x21dc(t, n) { - const r = _0xd99c(); - return (_0x21dc = function (t, n) { - return r[(t -= 483)]; - })(t, n); -} -!(function (t, n) { - const r = _0x21dc, - e = _0xd99c(); - for (;;) - try { - if ( - 508287 === - parseInt(r(505)) / 1 + - -parseInt(r(488)) / 2 + - parseInt(r(490)) / 3 + - parseInt(r(501)) / 4 + - parseInt(r(502)) / 5 + - -parseInt(r(491)) / 6 + - parseInt(r(492)) / 7 - ) - break; - e.push(e.shift()); - } catch (t) { - e.push(e.shift()); - } -})(); -import { readNumber, display } from '../../../lib/dom-io.js'; -function _0xd99c() { - const t = [ - 'secret-sol', - 'left', - 'right', - 'ugzpR', - 'addEventLi', - '2667472duExbP', - '3677530THnZJl', - 'do-math', - 'getElement', - '161228isIzuf', - 'click', - 'DAQiV', - 'stener', - 'ById', - 'kSLmN', - 'ZThmD', - '1966374DvFfCi', - 'DIQyE', - '30264iRknoy', - '1468272UpOAFU', - '1137472zQdtzn', - 'ution', - 'gtvRI', - 'rUNle', - ]; - return (_0xd99c = function () { - return t; - })(); -} -document[_0x22f7f9(504) + _0x22f7f9(485)](_0x22f7f9(503))[ - _0x22f7f9(500) + _0x22f7f9(484) -](_0x22f7f9(506), () => { - const t = _0x22f7f9, - n = { - DAQiV: function (t, n) { - return t(n); - }, - ZThmD: t(497), - ugzpR: function (t, n) { - return t(n); - }, - DIQyE: t(498), - rUNle: function (t, n) { - return t < n; - }, - kSLmN: function (t, n, r) { - return t(n, r); - }, - gtvRI: t(496) + t(493), - }, - r = n[t(483)](readNumber, n[t(487)]), - e = n[t(499)](readNumber, n[t(489)]); - let f = 0; - for (let c = 0; n[t(495)](c, r); c++) f += e; - n[t(486)](display, n[t(494)], f); -}); diff --git a/2-control-flow/3-dom-ui/repeat-characters/index.html b/2-control-flow/3-dom-ui/repeat-characters/index.html deleted file mode 100644 index dc22474..0000000 --- a/2-control-flow/3-dom-ui/repeat-characters/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- - - -
- -your output: - - -
- -expected output: - -repeat characters - - - - - -- repeat each character in this string: - - - - - - diff --git a/2-control-flow/3-dom-ui/repeat-characters/script.js b/2-control-flow/3-dom-ui/repeat-characters/script.js deleted file mode 100644 index 3ac9d8f..0000000 --- a/2-control-flow/3-dom-ui/repeat-characters/script.js +++ /dev/null @@ -1,15 +0,0 @@ -import { readNumber, readString, display } from '../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user values - - // repeat the characters in the text - - for (_; _; _) { - for (_; _; _) {} - } - - // display the text with repeated characters -}); diff --git a/2-control-flow/3-dom-ui/repeat-characters/script.re.js b/2-control-flow/3-dom-ui/repeat-characters/script.re.js deleted file mode 100644 index 64f9c8b..0000000 --- a/2-control-flow/3-dom-ui/repeat-characters/script.re.js +++ /dev/null @@ -1,88 +0,0 @@ -const _0xb5d99f = _0x4e02; -function _0x4e02(t, e) { - const n = _0x5234(); - return (_0x4e02 = function (t, e) { - return n[(t -= 368)]; - })(t, e); -} -!(function (t, e) { - const n = _0x4e02, - r = _0x5234(); - for (;;) - try { - if ( - 341716 === - -parseInt(n(370)) / 1 + - (-parseInt(n(383)) / 2) * (-parseInt(n(377)) / 3) + - (-parseInt(n(379)) / 4) * (parseInt(n(368)) / 5) + - -parseInt(n(393)) / 6 + - -parseInt(n(374)) / 7 + - parseInt(n(382)) / 8 + - parseInt(n(384)) / 9 - ) - break; - r.push(r.shift()); - } catch (t) { - r.push(r.shift()); - } -})(); -import { readNumber, readString, display } from '../../../lib/dom-io.js'; -function _0x5234() { - const t = [ - 'rtcHc', - 'getElement', - 'ution', - 'number-of-', - '2725032QpOYbz', - 'mFJTB', - '425SYBxQh', - 'SqVcC', - '526376xJqkeX', - 'repeat-the', - 'user-text', - 'times', - '2661981PpjoLg', - 'nawrc', - 'ById', - '21WvpjTa', - 'secret-sol', - '18412xgiVvn', - 'ECwVb', - 'addEventLi', - '3947208oksAHJ', - '604guowxK', - '14384583mFSAPe', - 'length', - 'click', - 'stener', - 'IZrFS', - ]; - return (_0x5234 = function () { - return t; - })(); -} -document[_0xb5d99f(390) + _0xb5d99f(376)](_0xb5d99f(371) + 'm')[ - _0xb5d99f(381) + _0xb5d99f(387) -](_0xb5d99f(386), () => { - const t = _0xb5d99f, - e = { - ECwVb: function (t, e) { - return t(e); - }, - SqVcC: t(372), - mFJTB: t(392) + t(373), - nawrc: function (t, e) { - return t < e; - }, - rtcHc: function (t, e, n) { - return t(e, n); - }, - IZrFS: t(378) + t(391), - }, - n = e[t(380)](readString, e[t(369)]), - r = e[t(380)](readNumber, e[t(394)]); - let c = ''; - for (let o = 0; e[t(375)](o, n[t(385)]); o++) - for (let s = 0; e[t(375)](s, r); s++) c += n[o]; - e[t(389)](display, e[t(388)], c); -}); diff --git a/2-control-flow/3-dom-ui/repeat-string/index.html b/2-control-flow/3-dom-ui/repeat-string/index.html deleted file mode 100644 index 936f5bb..0000000 --- a/2-control-flow/3-dom-ui/repeat-string/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -
- this many tines: -
- - - -
- -your output: - - -
- -expected output: - -repeat string - - - - - -- repeat this string: - - - - - diff --git a/2-control-flow/3-dom-ui/repeat-string/script.js b/2-control-flow/3-dom-ui/repeat-string/script.js deleted file mode 100644 index bfdae1b..0000000 --- a/2-control-flow/3-dom-ui/repeat-string/script.js +++ /dev/null @@ -1,11 +0,0 @@ -import { readNumber, readString, display } from '../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user values - - // repeat the string - - // display the repeated string -}); diff --git a/2-control-flow/3-dom-ui/repeat-string/script.re.js b/2-control-flow/3-dom-ui/repeat-string/script.re.js deleted file mode 100644 index 4a5d7dd..0000000 --- a/2-control-flow/3-dom-ui/repeat-string/script.re.js +++ /dev/null @@ -1,87 +0,0 @@ -function _0x364d() { - const t = [ - 'addEventLi', - 'stener', - '19969050iXGEmW', - 'ution', - 'rlmtC', - '37176xDqwGw', - 'number-of-', - '15vEcczn', - 'ById', - '6921702YqBkwt', - '410862hKLsbi', - 'cVVnX', - '651ihODJx', - 'wXtXa', - 'secret-sol', - 'repeat-it', - '2506018COgcFU', - 'click', - '15963UiJIHi', - 'getElement', - 'gLqRE', - '544KDZhZk', - 'user-text', - '1221794wbCcAS', - 'eBpLS', - 'TUmrR', - 'times', - ]; - return (_0x364d = function () { - return t; - })(); -} -const _0x42f7a6 = _0x4d63; -!(function (t, n) { - const r = _0x4d63, - e = _0x364d(); - for (;;) - try { - if ( - 788096 === - -parseInt(r(419)) / 1 + - -parseInt(r(412)) / 2 + - (parseInt(r(414)) / 3) * (parseInt(r(417)) / 4) + - (-parseInt(r(403)) / 5) * (-parseInt(r(406)) / 6) + - (-parseInt(r(408)) / 7) * (parseInt(r(401)) / 8) + - parseInt(r(405)) / 9 + - parseInt(r(398)) / 10 - ) - break; - e.push(e.shift()); - } catch (t) { - e.push(e.shift()); - } -})(); -import { readNumber, readString, display } from '../../../lib/dom-io.js'; -function _0x4d63(t, n) { - const r = _0x364d(); - return (_0x4d63 = function (t, n) { - return r[(t -= 398)]; - })(t, n); -} -document[_0x42f7a6(415) + _0x42f7a6(404)](_0x42f7a6(411))[ - _0x42f7a6(423) + _0x42f7a6(424) -](_0x42f7a6(413), () => { - const t = _0x42f7a6, - n = { - gLqRE: function (t, n) { - return t(n); - }, - wXtXa: t(418), - TUmrR: t(402) + t(422), - eBpLS: function (t, n) { - return t < n; - }, - rlmtC: function (t, n, r) { - return t(n, r); - }, - cVVnX: t(410) + t(399), - }, - r = n[t(416)](readString, n[t(409)]), - e = n[t(416)](readNumber, n[t(421)]); - let a = ''; - for (let i = 0; n[t(420)](i, e); i++) a += r; - n[t(400)](display, n[t(407)], a); -}); diff --git a/2-control-flow/3-dom-ui/reverse-string/index.html b/2-control-flow/3-dom-ui/reverse-string/index.html deleted file mode 100644 index ca65f0a..0000000 --- a/2-control-flow/3-dom-ui/reverse-string/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -
- this many tines: -
- - - -
- -your output: - - -
- -expected output: - -reverse string - - - - - -- reverse this string: - - - - - diff --git a/2-control-flow/3-dom-ui/reverse-string/script.js b/2-control-flow/3-dom-ui/reverse-string/script.js deleted file mode 100644 index 54f0ebf..0000000 --- a/2-control-flow/3-dom-ui/reverse-string/script.js +++ /dev/null @@ -1,11 +0,0 @@ -import { readString, display } from '../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user text - - // use a for loop that counts down (i--) to reverse the input - - // display the reversed string -}); diff --git a/2-control-flow/3-dom-ui/reverse-string/script.re.js b/2-control-flow/3-dom-ui/reverse-string/script.re.js deleted file mode 100644 index 0116590..0000000 --- a/2-control-flow/3-dom-ui/reverse-string/script.re.js +++ /dev/null @@ -1,88 +0,0 @@ -const _0x314480 = _0x370b; -function _0x3c24() { - const t = [ - 'RtJAe', - '2sGralD', - 'ution', - 'saDJo', - 'ById', - '11489488ZhWQBl', - 'reverse-it', - 'user-text', - 'PplZc', - '5554779kYUBJS', - 'length', - '504351VdYWlJ', - '30791057fMjkQa', - 'addEventLi', - 'TFJuj', - 'secret-sol', - '14DkCpAs', - '580632BfYZPy', - '60CGixJZ', - 'stener', - 'JojXJ', - '310esptOT', - 'getElement', - 'ruBFK', - '5543508jBnoNq', - '1398001ZOSIdc', - 'click', - ]; - return (_0x3c24 = function () { - return t; - })(); -} -!(function (t, n) { - const r = _0x370b, - e = _0x3c24(); - for (;;) - try { - if ( - 943114 === - -parseInt(r(272)) / 1 + - (parseInt(r(275)) / 2) * (parseInt(r(283)) / 3) + - (-parseInt(r(291)) / 4) * (-parseInt(r(292)) / 5) + - (-parseInt(r(271)) / 6) * (-parseInt(r(290)) / 7) + - parseInt(r(279)) / 8 + - (-parseInt(r(285)) / 9) * (parseInt(r(295)) / 10) + - -parseInt(r(286)) / 11 - ) - break; - e.push(e.shift()); - } catch (t) { - e.push(e.shift()); - } -})(); -import { readString, display } from '../../../lib/dom-io.js'; -function _0x370b(t, n) { - const r = _0x3c24(); - return (_0x370b = function (t, n) { - return r[(t -= 269)]; - })(t, n); -} -document[_0x314480(269) + _0x314480(278)](_0x314480(280))[ - _0x314480(287) + _0x314480(293) -](_0x314480(273), () => { - const t = _0x314480, - n = { - ruBFK: function (t, n) { - return t(n); - }, - RtJAe: t(281), - PplZc: function (t, n) { - return t - n; - }, - JojXJ: function (t, n) { - return t >= n; - }, - TFJuj: function (t, n, r) { - return t(n, r); - }, - saDJo: t(289) + t(276), - }, - r = n[t(270)](readString, n[t(274)]); - let e = ''; - for (let s = n[t(282)](r[t(284)], 1); n[t(294)](s, 0); s--) e += r[s]; - n[t(288)](display, n[t(277)], e); -}); diff --git a/2-control-flow/3-dom-ui/skip/index.html b/2-control-flow/3-dom-ui/skip/index.html deleted file mode 100644 index 25dbdc6..0000000 --- a/2-control-flow/3-dom-ui/skip/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- -
- - - -
- -your output: - - -
- -expected output: - -skip - - - - - -- skip this many characters: - - - - - - diff --git a/2-control-flow/3-dom-ui/skip/script.js b/2-control-flow/3-dom-ui/skip/script.js deleted file mode 100644 index 632b78c..0000000 --- a/2-control-flow/3-dom-ui/skip/script.js +++ /dev/null @@ -1,11 +0,0 @@ -import { readNumber, readString, display } from '../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user values - - // create a new string with skipped characters - - // display the skipped string -}); diff --git a/2-control-flow/3-dom-ui/skip/script.re.js b/2-control-flow/3-dom-ui/skip/script.re.js deleted file mode 100644 index 4ce3a35..0000000 --- a/2-control-flow/3-dom-ui/skip/script.re.js +++ /dev/null @@ -1,92 +0,0 @@ -function _0x5b54(n, t) { - const e = _0x2a56(); - return (_0x5b54 = function (n, t) { - return e[(n -= 199)]; - })(n, t); -} -function _0x2a56() { - const n = [ - 'kHICf', - 'XwHbC', - 'skip-them', - 'VsvhF', - '5463430cRDskf', - '4KEeUAy', - '46258641CmQbjR', - 'kffQS', - '12807wJnILJ', - 'addEventLi', - '2152FsYdQN', - 'HioKn', - 'stener', - 'skip-size', - 'user-text', - '552588OsvZEs', - 'ById', - '49XuJxYZ', - '64xBKQGk', - 'Uubme', - 'secret-sol', - 'click', - 'ution', - 'BLjwT', - 'getElement', - '3964173urgyfO', - '13071740pCVQqY', - 'length', - '1721nGSSIv', - ]; - return (_0x2a56 = function () { - return n; - })(); -} -const _0x1c928d = _0x5b54; -!(function (n, t) { - const e = _0x5b54, - r = _0x2a56(); - for (;;) - try { - if ( - 690907 === - (-parseInt(e(224)) / 1) * (parseInt(e(214)) / 2) + - -parseInt(e(221)) / 3 + - (parseInt(e(201)) / 4) * (-parseInt(e(200)) / 5) + - (-parseInt(e(211)) / 6) * (-parseInt(e(213)) / 7) + - (-parseInt(e(206)) / 8) * (parseInt(e(204)) / 9) + - -parseInt(e(222)) / 10 + - parseInt(e(202)) / 11 - ) - break; - r.push(r.shift()); - } catch (n) { - r.push(r.shift()); - } -})(); -import { readNumber, readString, display } from '../../../lib/dom-io.js'; -document[_0x1c928d(220) + _0x1c928d(212)](_0x1c928d(227))[ - _0x1c928d(205) + _0x1c928d(208) -](_0x1c928d(217), () => { - const n = _0x1c928d, - t = { - HioKn: function (n, t) { - return n(t); - }, - kffQS: n(210), - Uubme: n(209), - kHICf: function (n, t) { - return n < t; - }, - VsvhF: function (n, t) { - return n + t; - }, - BLjwT: function (n, t, e) { - return n(t, e); - }, - XwHbC: n(216) + n(218), - }, - e = t[n(207)](readString, t[n(203)]), - r = t[n(207)](readNumber, t[n(215)]); - let s = ''; - for (let c = 0; t[n(225)](c, e[n(223)]); c = t[n(199)](c, r)) s += e[c]; - t[n(219)](display, t[n(226)], s); -}); diff --git a/2-control-flow/3-dom-ui/upside-down-pyramid/index.html b/2-control-flow/3-dom-ui/upside-down-pyramid/index.html deleted file mode 100644 index 480c18b..0000000 --- a/2-control-flow/3-dom-ui/upside-down-pyramid/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- in this text: -
- - - -
- -your output: - - -
- -expected output: - -upside down pyramid - - - - - -- create an upside down pyramid with this text: - - - - - - - - diff --git a/2-control-flow/3-dom-ui/upside-down-pyramid/script.js b/2-control-flow/3-dom-ui/upside-down-pyramid/script.js deleted file mode 100644 index 46bbf09..0000000 --- a/2-control-flow/3-dom-ui/upside-down-pyramid/script.js +++ /dev/null @@ -1,15 +0,0 @@ -import { readString, display } from '../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user text - - // create the pyramid - - for (_; _; _) { - for (_; _; _) {} - } - - // display the pyramid -}); diff --git a/2-control-flow/3-dom-ui/upside-down-pyramid/script.re.js b/2-control-flow/3-dom-ui/upside-down-pyramid/script.re.js deleted file mode 100644 index 218b3f1..0000000 --- a/2-control-flow/3-dom-ui/upside-down-pyramid/script.re.js +++ /dev/null @@ -1,90 +0,0 @@ -const _0x249d7f = _0x517a; -function _0x517a(n, t) { - const r = _0x4fac(); - return (_0x517a = function (n, t) { - return r[(n -= 175)]; - })(n, t); -} -!(function (n, t) { - const r = _0x517a, - e = _0x4fac(); - for (;;) - try { - if ( - 641495 === - parseInt(r(193)) / 1 + - -parseInt(r(184)) / 2 + - (parseInt(r(195)) / 3) * (-parseInt(r(177)) / 4) + - (-parseInt(r(187)) / 5) * (parseInt(r(198)) / 6) + - parseInt(r(196)) / 7 + - parseInt(r(186)) / 8 + - (parseInt(r(199)) / 9) * (parseInt(r(178)) / 10) - ) - break; - e.push(e.shift()); - } catch (n) { - e.push(e.shift()); - } -})(); -import { readString, display } from '../../../lib/dom-io.js'; -function _0x4fac() { - const n = [ - 'to-pyramid', - '3340072QrvFwP', - '50930pLpoKj', - 'ution', - 'ById', - 'secret-sol', - 'ccDch', - 'getElement', - '2424030gpGmyH', - 'addEventLi', - '9265040iFTJJE', - '1940910mgQmNz', - 'length', - 'aYXJC', - 'pyramid-it', - 'bqqNJ', - 'qeRNO', - '999977NCkfOA', - 'sdFYm', - '3wHpAjJ', - '3407684jOdLws', - 'stener', - '12KYhpIp', - '1449MydWXK', - 'mnVKk', - 'click', - ]; - return (_0x4fac = function () { - return n; - })(); -} -document[_0x249d7f(183) + _0x249d7f(180)](_0x249d7f(190))[ - _0x249d7f(185) + _0x249d7f(197) -](_0x249d7f(175), () => { - const n = _0x249d7f, - t = { - sdFYm: function (n, t) { - return n(t); - }, - ccDch: n(176), - qeRNO: function (n, t) { - return n < t; - }, - mnVKk: function (n, t) { - return n < t; - }, - aYXJC: function (n, t, r) { - return n(t, r); - }, - bqqNJ: n(181) + n(179), - }, - r = t[n(194)](readString, t[n(182)]); - let e = ''; - for (let c = 0; t[n(192)](c, r[n(188)]); c++) { - for (let a = c; t[n(200)](a, r[n(188)]); a++) e += r[a]; - e += '\n'; - } - t[n(189)](display, t[n(191)], e); -}); diff --git a/3-functions/.eslintrc.json b/3-functions/.eslintrc.json deleted file mode 100644 index 074cc94..0000000 --- a/3-functions/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "camelcase": [0] - } -} diff --git a/3-functions/3-the-callstack/study.json b/3-functions/3-the-callstack/study.json deleted file mode 100644 index e777897..0000000 --- a/3-functions/3-the-callstack/study.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "study": { - "trace": { - "operators": false, - "console": false, - "controlFlow": false, - "variablesDeclare": false, - "variablesAssign": false, - "variablesRead": false - } - } -} diff --git a/3-functions/study.json b/3-functions/study.json deleted file mode 100644 index 8373169..0000000 --- a/3-functions/study.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "study": { - "openIn": "jsTutorLive", - "ask": false - } -} diff --git a/4-unit-testing/README.md b/4-unit-testing/README.md deleted file mode 100644 index d72f192..0000000 --- a/4-unit-testing/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Unit Testing - -## Running Tests in VSCode - -> [Guide video](https://vimeo.com713215049) - -If you want to, you can run all of the tests in this repo using this NPM script: - -- `npm run test -- ./path/to/file.test.js` - -Check out the guides in this folder to learn more about using the VSCode -debugger. diff --git a/5-es-modules/.eslintrc.json b/5-es-modules/.eslintrc.json deleted file mode 100644 index bd14a19..0000000 --- a/5-es-modules/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "parserOptions": { - "sourceType": "module" - } -} diff --git a/5-es-modules/study.json b/5-es-modules/study.json deleted file mode 100644 index 1ba653a..0000000 --- a/5-es-modules/study.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "study": { - "type": "module", - "environment": true, - "flowchart": false, - "variables": false, - "loopGuard": false, - "ask": false, - "trace": false - } -} diff --git a/6-using-functions/5-dom-io/multiplication/index.html b/6-using-functions/5-dom-io/multiplication/index.html deleted file mode 100644 index 5ce8be1..0000000 --- a/6-using-functions/5-dom-io/multiplication/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -
- - - -
- -your output: - - -
- -expected output: - -multiplication - - - - - -- - X - - - - - - diff --git a/6-using-functions/5-dom-io/multiplication/script.js b/6-using-functions/5-dom-io/multiplication/script.js deleted file mode 100644 index e7b1212..0000000 --- a/6-using-functions/5-dom-io/multiplication/script.js +++ /dev/null @@ -1,7 +0,0 @@ -import { readNumber, display } from '../../../lib/dom-io.js'; - -import { _ } from './utils/_.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; -}); diff --git a/6-using-functions/5-dom-io/multiplication/script.re.js b/6-using-functions/5-dom-io/multiplication/script.re.js deleted file mode 100644 index 539a25f..0000000 --- a/6-using-functions/5-dom-io/multiplication/script.re.js +++ /dev/null @@ -1,87 +0,0 @@ -const _0x22f7f9 = _0x21dc; -function _0x21dc(t, n) { - const r = _0xd99c(); - return (_0x21dc = function (t, n) { - return r[(t -= 483)]; - })(t, n); -} -!(function (t, n) { - const r = _0x21dc, - e = _0xd99c(); - for (;;) - try { - if ( - 508287 === - parseInt(r(505)) / 1 + - -parseInt(r(488)) / 2 + - parseInt(r(490)) / 3 + - parseInt(r(501)) / 4 + - parseInt(r(502)) / 5 + - -parseInt(r(491)) / 6 + - parseInt(r(492)) / 7 - ) - break; - e.push(e.shift()); - } catch (t) { - e.push(e.shift()); - } -})(); -import { readNumber, display } from '../../../lib/dom-io.js'; -function _0xd99c() { - const t = [ - 'secret-sol', - 'left', - 'right', - 'ugzpR', - 'addEventLi', - '2667472duExbP', - '3677530THnZJl', - 'do-math', - 'getElement', - '161228isIzuf', - 'click', - 'DAQiV', - 'stener', - 'ById', - 'kSLmN', - 'ZThmD', - '1966374DvFfCi', - 'DIQyE', - '30264iRknoy', - '1468272UpOAFU', - '1137472zQdtzn', - 'ution', - 'gtvRI', - 'rUNle', - ]; - return (_0xd99c = function () { - return t; - })(); -} -document[_0x22f7f9(504) + _0x22f7f9(485)](_0x22f7f9(503))[ - _0x22f7f9(500) + _0x22f7f9(484) -](_0x22f7f9(506), () => { - const t = _0x22f7f9, - n = { - DAQiV: function (t, n) { - return t(n); - }, - ZThmD: t(497), - ugzpR: function (t, n) { - return t(n); - }, - DIQyE: t(498), - rUNle: function (t, n) { - return t < n; - }, - kSLmN: function (t, n, r) { - return t(n, r); - }, - gtvRI: t(496) + t(493), - }, - r = n[t(483)](readNumber, n[t(487)]), - e = n[t(499)](readNumber, n[t(489)]); - let f = 0; - for (let c = 0; n[t(495)](c, r); c++) f += e; - n[t(486)](display, n[t(494)], f); -}); diff --git a/6-using-functions/5-dom-io/repeat-characters/index.html b/6-using-functions/5-dom-io/repeat-characters/index.html deleted file mode 100644 index a7448f6..0000000 --- a/6-using-functions/5-dom-io/repeat-characters/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- - - -
- -your output: - - -
- -expected output: - -repeat characters - - - - - -- repeat each character in this string: - - - - - - diff --git a/6-using-functions/5-dom-io/repeat-characters/script.js b/6-using-functions/5-dom-io/repeat-characters/script.js deleted file mode 100644 index 3675856..0000000 --- a/6-using-functions/5-dom-io/repeat-characters/script.js +++ /dev/null @@ -1,7 +0,0 @@ -import { readNumber, readString, display } from '../../../lib/dom-io.js'; - -import { _ } from './utils/_.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; -}); diff --git a/6-using-functions/5-dom-io/repeat-characters/script.re.js b/6-using-functions/5-dom-io/repeat-characters/script.re.js deleted file mode 100644 index 64f9c8b..0000000 --- a/6-using-functions/5-dom-io/repeat-characters/script.re.js +++ /dev/null @@ -1,88 +0,0 @@ -const _0xb5d99f = _0x4e02; -function _0x4e02(t, e) { - const n = _0x5234(); - return (_0x4e02 = function (t, e) { - return n[(t -= 368)]; - })(t, e); -} -!(function (t, e) { - const n = _0x4e02, - r = _0x5234(); - for (;;) - try { - if ( - 341716 === - -parseInt(n(370)) / 1 + - (-parseInt(n(383)) / 2) * (-parseInt(n(377)) / 3) + - (-parseInt(n(379)) / 4) * (parseInt(n(368)) / 5) + - -parseInt(n(393)) / 6 + - -parseInt(n(374)) / 7 + - parseInt(n(382)) / 8 + - parseInt(n(384)) / 9 - ) - break; - r.push(r.shift()); - } catch (t) { - r.push(r.shift()); - } -})(); -import { readNumber, readString, display } from '../../../lib/dom-io.js'; -function _0x5234() { - const t = [ - 'rtcHc', - 'getElement', - 'ution', - 'number-of-', - '2725032QpOYbz', - 'mFJTB', - '425SYBxQh', - 'SqVcC', - '526376xJqkeX', - 'repeat-the', - 'user-text', - 'times', - '2661981PpjoLg', - 'nawrc', - 'ById', - '21WvpjTa', - 'secret-sol', - '18412xgiVvn', - 'ECwVb', - 'addEventLi', - '3947208oksAHJ', - '604guowxK', - '14384583mFSAPe', - 'length', - 'click', - 'stener', - 'IZrFS', - ]; - return (_0x5234 = function () { - return t; - })(); -} -document[_0xb5d99f(390) + _0xb5d99f(376)](_0xb5d99f(371) + 'm')[ - _0xb5d99f(381) + _0xb5d99f(387) -](_0xb5d99f(386), () => { - const t = _0xb5d99f, - e = { - ECwVb: function (t, e) { - return t(e); - }, - SqVcC: t(372), - mFJTB: t(392) + t(373), - nawrc: function (t, e) { - return t < e; - }, - rtcHc: function (t, e, n) { - return t(e, n); - }, - IZrFS: t(378) + t(391), - }, - n = e[t(380)](readString, e[t(369)]), - r = e[t(380)](readNumber, e[t(394)]); - let c = ''; - for (let o = 0; e[t(375)](o, n[t(385)]); o++) - for (let s = 0; e[t(375)](s, r); s++) c += n[o]; - e[t(389)](display, e[t(388)], c); -}); diff --git a/6-using-functions/5-dom-io/repeat-string/index.html b/6-using-functions/5-dom-io/repeat-string/index.html deleted file mode 100644 index 0414db5..0000000 --- a/6-using-functions/5-dom-io/repeat-string/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -
- this many tines: -
- - - -
- -your output: - - -
- -expected output: - -repeat string - - - - - -- repeat this string: - - - - - diff --git a/6-using-functions/5-dom-io/repeat-string/script.js b/6-using-functions/5-dom-io/repeat-string/script.js deleted file mode 100644 index 3675856..0000000 --- a/6-using-functions/5-dom-io/repeat-string/script.js +++ /dev/null @@ -1,7 +0,0 @@ -import { readNumber, readString, display } from '../../../lib/dom-io.js'; - -import { _ } from './utils/_.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; -}); diff --git a/6-using-functions/5-dom-io/repeat-string/script.re.js b/6-using-functions/5-dom-io/repeat-string/script.re.js deleted file mode 100644 index 4a5d7dd..0000000 --- a/6-using-functions/5-dom-io/repeat-string/script.re.js +++ /dev/null @@ -1,87 +0,0 @@ -function _0x364d() { - const t = [ - 'addEventLi', - 'stener', - '19969050iXGEmW', - 'ution', - 'rlmtC', - '37176xDqwGw', - 'number-of-', - '15vEcczn', - 'ById', - '6921702YqBkwt', - '410862hKLsbi', - 'cVVnX', - '651ihODJx', - 'wXtXa', - 'secret-sol', - 'repeat-it', - '2506018COgcFU', - 'click', - '15963UiJIHi', - 'getElement', - 'gLqRE', - '544KDZhZk', - 'user-text', - '1221794wbCcAS', - 'eBpLS', - 'TUmrR', - 'times', - ]; - return (_0x364d = function () { - return t; - })(); -} -const _0x42f7a6 = _0x4d63; -!(function (t, n) { - const r = _0x4d63, - e = _0x364d(); - for (;;) - try { - if ( - 788096 === - -parseInt(r(419)) / 1 + - -parseInt(r(412)) / 2 + - (parseInt(r(414)) / 3) * (parseInt(r(417)) / 4) + - (-parseInt(r(403)) / 5) * (-parseInt(r(406)) / 6) + - (-parseInt(r(408)) / 7) * (parseInt(r(401)) / 8) + - parseInt(r(405)) / 9 + - parseInt(r(398)) / 10 - ) - break; - e.push(e.shift()); - } catch (t) { - e.push(e.shift()); - } -})(); -import { readNumber, readString, display } from '../../../lib/dom-io.js'; -function _0x4d63(t, n) { - const r = _0x364d(); - return (_0x4d63 = function (t, n) { - return r[(t -= 398)]; - })(t, n); -} -document[_0x42f7a6(415) + _0x42f7a6(404)](_0x42f7a6(411))[ - _0x42f7a6(423) + _0x42f7a6(424) -](_0x42f7a6(413), () => { - const t = _0x42f7a6, - n = { - gLqRE: function (t, n) { - return t(n); - }, - wXtXa: t(418), - TUmrR: t(402) + t(422), - eBpLS: function (t, n) { - return t < n; - }, - rlmtC: function (t, n, r) { - return t(n, r); - }, - cVVnX: t(410) + t(399), - }, - r = n[t(416)](readString, n[t(409)]), - e = n[t(416)](readNumber, n[t(421)]); - let a = ''; - for (let i = 0; n[t(420)](i, e); i++) a += r; - n[t(400)](display, n[t(407)], a); -}); diff --git a/6-using-functions/5-dom-io/reverse-string/index.html b/6-using-functions/5-dom-io/reverse-string/index.html deleted file mode 100644 index 18a58b1..0000000 --- a/6-using-functions/5-dom-io/reverse-string/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -
- this many tines: -
- - - -
- -your output: - - -
- -expected output: - -reverse string - - - - - -- reverse this string: - - - - - diff --git a/6-using-functions/5-dom-io/reverse-string/script.js b/6-using-functions/5-dom-io/reverse-string/script.js deleted file mode 100644 index 2e5c9d1..0000000 --- a/6-using-functions/5-dom-io/reverse-string/script.js +++ /dev/null @@ -1,7 +0,0 @@ -import { readString, display } from '../../../lib/dom-io.js'; - -import { _ } from './utils/_.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; -}); diff --git a/6-using-functions/5-dom-io/reverse-string/script.re.js b/6-using-functions/5-dom-io/reverse-string/script.re.js deleted file mode 100644 index 0116590..0000000 --- a/6-using-functions/5-dom-io/reverse-string/script.re.js +++ /dev/null @@ -1,88 +0,0 @@ -const _0x314480 = _0x370b; -function _0x3c24() { - const t = [ - 'RtJAe', - '2sGralD', - 'ution', - 'saDJo', - 'ById', - '11489488ZhWQBl', - 'reverse-it', - 'user-text', - 'PplZc', - '5554779kYUBJS', - 'length', - '504351VdYWlJ', - '30791057fMjkQa', - 'addEventLi', - 'TFJuj', - 'secret-sol', - '14DkCpAs', - '580632BfYZPy', - '60CGixJZ', - 'stener', - 'JojXJ', - '310esptOT', - 'getElement', - 'ruBFK', - '5543508jBnoNq', - '1398001ZOSIdc', - 'click', - ]; - return (_0x3c24 = function () { - return t; - })(); -} -!(function (t, n) { - const r = _0x370b, - e = _0x3c24(); - for (;;) - try { - if ( - 943114 === - -parseInt(r(272)) / 1 + - (parseInt(r(275)) / 2) * (parseInt(r(283)) / 3) + - (-parseInt(r(291)) / 4) * (-parseInt(r(292)) / 5) + - (-parseInt(r(271)) / 6) * (-parseInt(r(290)) / 7) + - parseInt(r(279)) / 8 + - (-parseInt(r(285)) / 9) * (parseInt(r(295)) / 10) + - -parseInt(r(286)) / 11 - ) - break; - e.push(e.shift()); - } catch (t) { - e.push(e.shift()); - } -})(); -import { readString, display } from '../../../lib/dom-io.js'; -function _0x370b(t, n) { - const r = _0x3c24(); - return (_0x370b = function (t, n) { - return r[(t -= 269)]; - })(t, n); -} -document[_0x314480(269) + _0x314480(278)](_0x314480(280))[ - _0x314480(287) + _0x314480(293) -](_0x314480(273), () => { - const t = _0x314480, - n = { - ruBFK: function (t, n) { - return t(n); - }, - RtJAe: t(281), - PplZc: function (t, n) { - return t - n; - }, - JojXJ: function (t, n) { - return t >= n; - }, - TFJuj: function (t, n, r) { - return t(n, r); - }, - saDJo: t(289) + t(276), - }, - r = n[t(270)](readString, n[t(274)]); - let e = ''; - for (let s = n[t(282)](r[t(284)], 1); n[t(294)](s, 0); s--) e += r[s]; - n[t(288)](display, n[t(277)], e); -}); diff --git a/6-using-functions/5-dom-io/skip/index.html b/6-using-functions/5-dom-io/skip/index.html deleted file mode 100644 index 388d375..0000000 --- a/6-using-functions/5-dom-io/skip/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- -
- - - -
- -your output: - - -
- -expected output: - -skip - - - - - -- skip this many characters: - - - - - - diff --git a/6-using-functions/5-dom-io/skip/script.js b/6-using-functions/5-dom-io/skip/script.js deleted file mode 100644 index 3675856..0000000 --- a/6-using-functions/5-dom-io/skip/script.js +++ /dev/null @@ -1,7 +0,0 @@ -import { readNumber, readString, display } from '../../../lib/dom-io.js'; - -import { _ } from './utils/_.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; -}); diff --git a/6-using-functions/5-dom-io/skip/script.re.js b/6-using-functions/5-dom-io/skip/script.re.js deleted file mode 100644 index 4ce3a35..0000000 --- a/6-using-functions/5-dom-io/skip/script.re.js +++ /dev/null @@ -1,92 +0,0 @@ -function _0x5b54(n, t) { - const e = _0x2a56(); - return (_0x5b54 = function (n, t) { - return e[(n -= 199)]; - })(n, t); -} -function _0x2a56() { - const n = [ - 'kHICf', - 'XwHbC', - 'skip-them', - 'VsvhF', - '5463430cRDskf', - '4KEeUAy', - '46258641CmQbjR', - 'kffQS', - '12807wJnILJ', - 'addEventLi', - '2152FsYdQN', - 'HioKn', - 'stener', - 'skip-size', - 'user-text', - '552588OsvZEs', - 'ById', - '49XuJxYZ', - '64xBKQGk', - 'Uubme', - 'secret-sol', - 'click', - 'ution', - 'BLjwT', - 'getElement', - '3964173urgyfO', - '13071740pCVQqY', - 'length', - '1721nGSSIv', - ]; - return (_0x2a56 = function () { - return n; - })(); -} -const _0x1c928d = _0x5b54; -!(function (n, t) { - const e = _0x5b54, - r = _0x2a56(); - for (;;) - try { - if ( - 690907 === - (-parseInt(e(224)) / 1) * (parseInt(e(214)) / 2) + - -parseInt(e(221)) / 3 + - (parseInt(e(201)) / 4) * (-parseInt(e(200)) / 5) + - (-parseInt(e(211)) / 6) * (-parseInt(e(213)) / 7) + - (-parseInt(e(206)) / 8) * (parseInt(e(204)) / 9) + - -parseInt(e(222)) / 10 + - parseInt(e(202)) / 11 - ) - break; - r.push(r.shift()); - } catch (n) { - r.push(r.shift()); - } -})(); -import { readNumber, readString, display } from '../../../lib/dom-io.js'; -document[_0x1c928d(220) + _0x1c928d(212)](_0x1c928d(227))[ - _0x1c928d(205) + _0x1c928d(208) -](_0x1c928d(217), () => { - const n = _0x1c928d, - t = { - HioKn: function (n, t) { - return n(t); - }, - kffQS: n(210), - Uubme: n(209), - kHICf: function (n, t) { - return n < t; - }, - VsvhF: function (n, t) { - return n + t; - }, - BLjwT: function (n, t, e) { - return n(t, e); - }, - XwHbC: n(216) + n(218), - }, - e = t[n(207)](readString, t[n(203)]), - r = t[n(207)](readNumber, t[n(215)]); - let s = ''; - for (let c = 0; t[n(225)](c, e[n(223)]); c = t[n(199)](c, r)) s += e[c]; - t[n(219)](display, t[n(226)], s); -}); diff --git a/6-using-functions/5-dom-io/upside-down-pyramid/index.html b/6-using-functions/5-dom-io/upside-down-pyramid/index.html deleted file mode 100644 index 8ed1189..0000000 --- a/6-using-functions/5-dom-io/upside-down-pyramid/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- in this text: -
- - - -
- -your output: - - -
- -expected output: - -upside down pyramid - - - - - -- create an upside down pyramid with this text: - - - - - - - - diff --git a/6-using-functions/5-dom-io/upside-down-pyramid/script.js b/6-using-functions/5-dom-io/upside-down-pyramid/script.js deleted file mode 100644 index 2e5c9d1..0000000 --- a/6-using-functions/5-dom-io/upside-down-pyramid/script.js +++ /dev/null @@ -1,7 +0,0 @@ -import { readString, display } from '../../../lib/dom-io.js'; - -import { _ } from './utils/_.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; -}); diff --git a/6-using-functions/5-dom-io/upside-down-pyramid/script.re.js b/6-using-functions/5-dom-io/upside-down-pyramid/script.re.js deleted file mode 100644 index 218b3f1..0000000 --- a/6-using-functions/5-dom-io/upside-down-pyramid/script.re.js +++ /dev/null @@ -1,90 +0,0 @@ -const _0x249d7f = _0x517a; -function _0x517a(n, t) { - const r = _0x4fac(); - return (_0x517a = function (n, t) { - return r[(n -= 175)]; - })(n, t); -} -!(function (n, t) { - const r = _0x517a, - e = _0x4fac(); - for (;;) - try { - if ( - 641495 === - parseInt(r(193)) / 1 + - -parseInt(r(184)) / 2 + - (parseInt(r(195)) / 3) * (-parseInt(r(177)) / 4) + - (-parseInt(r(187)) / 5) * (parseInt(r(198)) / 6) + - parseInt(r(196)) / 7 + - parseInt(r(186)) / 8 + - (parseInt(r(199)) / 9) * (parseInt(r(178)) / 10) - ) - break; - e.push(e.shift()); - } catch (n) { - e.push(e.shift()); - } -})(); -import { readString, display } from '../../../lib/dom-io.js'; -function _0x4fac() { - const n = [ - 'to-pyramid', - '3340072QrvFwP', - '50930pLpoKj', - 'ution', - 'ById', - 'secret-sol', - 'ccDch', - 'getElement', - '2424030gpGmyH', - 'addEventLi', - '9265040iFTJJE', - '1940910mgQmNz', - 'length', - 'aYXJC', - 'pyramid-it', - 'bqqNJ', - 'qeRNO', - '999977NCkfOA', - 'sdFYm', - '3wHpAjJ', - '3407684jOdLws', - 'stener', - '12KYhpIp', - '1449MydWXK', - 'mnVKk', - 'click', - ]; - return (_0x4fac = function () { - return n; - })(); -} -document[_0x249d7f(183) + _0x249d7f(180)](_0x249d7f(190))[ - _0x249d7f(185) + _0x249d7f(197) -](_0x249d7f(175), () => { - const n = _0x249d7f, - t = { - sdFYm: function (n, t) { - return n(t); - }, - ccDch: n(176), - qeRNO: function (n, t) { - return n < t; - }, - mnVKk: function (n, t) { - return n < t; - }, - aYXJC: function (n, t, r) { - return n(t, r); - }, - bqqNJ: n(181) + n(179), - }, - r = t[n(194)](readString, t[n(182)]); - let e = ''; - for (let c = 0; t[n(192)](c, r[n(188)]); c++) { - for (let a = c; t[n(200)](a, r[n(188)]); a++) e += r[a]; - e += '\n'; - } - t[n(189)](display, t[n(191)], e); -}); diff --git a/6-using-functions/study.json b/6-using-functions/study.json deleted file mode 100644 index e8f8008..0000000 --- a/6-using-functions/study.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "study": { - "type": "module", - "environment": true, - "ask": false, - "trace": false - } -} diff --git a/7-arrays/1-isolate/study.json b/7-arrays/1-isolate/study.json deleted file mode 100644 index 8373169..0000000 --- a/7-arrays/1-isolate/study.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "study": { - "openIn": "jsTutorLive", - "ask": false - } -} diff --git a/7-arrays/2-practice/study.json b/7-arrays/2-practice/study.json deleted file mode 100644 index 280e13a..0000000 --- a/7-arrays/2-practice/study.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "study": { - "type": "module", - "environment": true - } -} diff --git a/7-arrays/3-integrate/study.json b/7-arrays/3-integrate/study.json deleted file mode 100644 index 280e13a..0000000 --- a/7-arrays/3-integrate/study.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "study": { - "type": "module", - "environment": true - } -} diff --git a/7-arrays/study.json b/7-arrays/study.json deleted file mode 100644 index e52b7ab..0000000 --- a/7-arrays/study.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "study": { - "flowchart": false, - "loopGuard": false, - "variables": false, - "blanks": false, - "trace": false, - "ask": false - } -} diff --git a/8-functional-array-methods/1-isolate/1-array-strategies/examples/study.json b/8-functional-array-methods/1-isolate/1-array-strategies/examples/study.json deleted file mode 100644 index bddfb01..0000000 --- a/8-functional-array-methods/1-isolate/1-array-strategies/examples/study.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "study": { - "openIn": true - } -} diff --git a/8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/study.json b/8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/study.json deleted file mode 100644 index bddfb01..0000000 --- a/8-functional-array-methods/1-isolate/3-higher-order-strategies/examples/study.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "study": { - "openIn": true - } -} diff --git a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/study.json b/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/study.json deleted file mode 100644 index bddfb01..0000000 --- a/8-functional-array-methods/1-isolate/4-functional-array-methods/examples/study.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "study": { - "openIn": true - } -} diff --git a/8-functional-array-methods/1-isolate/study.json b/8-functional-array-methods/1-isolate/study.json deleted file mode 100644 index c22a7cf..0000000 --- a/8-functional-array-methods/1-isolate/study.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "study": { - "openIn": "jsTutorLive" - } -} diff --git a/8-functional-array-methods/2-practice/study.json b/8-functional-array-methods/2-practice/study.json deleted file mode 100644 index 3125020..0000000 --- a/8-functional-array-methods/2-practice/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "study": { - "openIn": false, - "ask": false, - "trace": false, - "type": "module", - "environment": true - } -} diff --git a/8-functional-array-methods/3-implicit-return/study.json b/8-functional-array-methods/3-implicit-return/study.json deleted file mode 100644 index baa06ad..0000000 --- a/8-functional-array-methods/3-implicit-return/study.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "study": { - "type": "module" - } -} diff --git a/9-multiple-interactions/README.md b/9-multiple-interactions/README.md deleted file mode 100644 index 5d3bdbf..0000000 --- a/9-multiple-interactions/README.md +++ /dev/null @@ -1 +0,0 @@ -# Multiple Interactions diff --git a/README.md b/README.md index 47fe541..ecd4118 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Inside JS - - --- ## Learning Objectives @@ -32,7 +30,7 @@ your study time and to measure your progress: -### [0. Asserting](./0-asserting) +### [0. Asserting](./00-asserting) - **Skills**: - [ ] 🥚 **Predicting Execution**: You can use the browser's debugger to step @@ -56,7 +54,7 @@ your study time and to measure your progress: - [ ] 🥚 **`console.assert`**: You can use the `console.assert` for assertion testing, and can write a helpful message assertion message. -### [1. Primitives and Operators](./1-primitives-and-operators) +### [1. Primitives and Operators](./01-primitives-and-operators) - **Skills**: - [ ] 🥚 **Predicting Truthiness**: You can predict the truthiness of any @@ -91,7 +89,42 @@ your study time and to measure your progress: - [ ] 🐔 **Arithmetic**: You can use JavaScript to do math, and can explain or debug your expressions when they evaluate to something unexpected. -### [2. Control Flow](./2-control-flow) +### [2. Just Enough DOM](./02-just-enough-dom) + +- **Skills**: + - [ ] 🥚 **Event-Driven Programming**: You can explain and discuss this + _programming paradigm_ in terms of the user interface, user + interactions, and processing user input. + - [ ] 🐣 **Entry Points**: You can explain the concept of _program entry + points_ by describing which lines of code are executed when a program is + loaded, and which lines of code are executed when a user takes an + action. + - [ ] 🐣 **Program Structure**: You can understand and modify programs using + the structure described in `/02-just-enough-dom` - _imports_, + _description_, _constants_, _state_, _DOM elements_, _interactions_, + _initialization_. +- **Language Features**: You are comfortable reading, tracing, and completing + programs that use ... + - [ ] 🥚 **`document.getElementById('')`**: You can access a single DOM + element using it's unique ID attribute, and save it to a variable for + use in your program. + - [ ] 🥚 **`checkbox.checked`**: You can read a boolean value from inputs with + `type="checkbox"`. + - [ ] 🥚 **`Number(numberInput.value)`**: You can read a string value from + inputs with `type="number"` and cast the value to type `number` in your + program. + - [ ] 🥚 **`otherInput.value`**: You can read a string value from all other + input types. + - [ ] 🥚 **`pre.innerText`**: You can display a formatted string in the DOM by + assigning to a `
- - - -
- -your output: - - -
- -expected output: - -` element's `.innerText` property. + - [ ] 🐣 **`element.addEventListener('input'/'click', () => {})`**: You can + define what code should be executed when a user interacts with a + specific element. You do not need to completely understand this syntax + or how functions work, it's enough if you can complete the exercises in + this chapter. (You'll learn about functions later on, then it will all + make sense.) + +### [3. Control Flow](./03-control-flow) - **Skills**: - [ ] 🥚 **Imperative Programming**: You can define the _imperative_ @@ -131,7 +164,7 @@ your study time and to measure your progress: - [ ] 🐣 **Continue**: You can predict and trace simple programs that use `continue`. -### [3. Functions](./3-functions) +### [4. Functions](./04-functions) - **Skills**: - [ ] 🥚 **Tracing**: You can use the debugger to predict and check the @@ -165,7 +198,7 @@ your study time and to measure your progress: 3. **Parent Scope Variables**: A variable that was declared outside of the function but used inside the function (avoid this for now.) -### [5. Unit Testing](./5-unit-testing) +### [5. Unit Testing](./05-unit-testing) - **Skills**: - [ ] 🥚 **Testing Environments**: You understand that the conventional @@ -191,7 +224,7 @@ your study time and to measure your progress: - **Language Features**: - nothing new here! -### [6. ES Modules](./6-es-modules) +### [6. ES Modules](./06-es-modules) - **Skills**: - [ ] 🥚 **Spec Files**: You can work with functions and unit tests separated @@ -212,7 +245,7 @@ your study time and to measure your progress: - [ ] 🐥 **Module Life-Cycle**: You understand that ES Modules are _static_, and are evaluated at _creation phase_. -### [6. Using Functions](./6-using-functions) +### [7. Using Functions](./07-using-functions) - **Skills**: - [ ] 🥚 **Procedural Programming**: You can define the _procedural_ @@ -229,7 +262,7 @@ your study time and to measure your progress: - **Language Features**: - Nothing new here! -### [7. Arrays](./7-arrays) +### [8. Arrays](./08-arrays) - **Skills**: - [ ] 🥚 **Reference vs. Value**: You can explain how arrays are stored in @@ -263,8 +296,8 @@ your study time and to measure your progress: remove items in an array: - [ ] **arr.push()**: Adds a new item to the end of an array. - [ ] **arr.pop()**: Removes the last item in an array. - - [ ] **arr.shift()**: Adds a new item to the front of an array. - - [ ] **arr.unshift()**: Removes the first item in an array. + - [ ] **arr.shift()**: Removes the first item in an array. + - [ ] **arr.unshift()**: Adds a new item to the front of an array. - 🥚 **Reading Items**: You can read items in an array using: - [ ] **arr[i]**: Access a specific item in an array using square brackets a positive index. @@ -282,7 +315,7 @@ your study time and to measure your progress: - [ ] 🥚 **Spread Syntax**: you can use spread syntax to create a _shallow_ copy of an array: `const shallowCopy = [...arr];` -### [8. Functional Array Methods](./8-functional-array-methods) +### [9. Functional Array Methods](./09-functional-array-methods) - **Skills**: - [ ] 🥚 **Declarative Programming**: You can define the _declarative_ @@ -326,7 +359,7 @@ your study time and to measure your progress: with an implicit return and can decide if it makes your code more or less readable. -### [9. Multiple Interactions](./9-multiple-interactions) +### [10. Multiple Interactions](./10-multiple-interactions) - **Skills**: - [ ] 🥚 **Avoiding Side Effects**: You can read, debug and write functions diff --git a/lesson-plans/for-loops/1-isolate/exercises/study.json b/lesson-plans/for-loops/1-isolate/exercises/study.json deleted file mode 100644 index 474c918..0000000 --- a/lesson-plans/for-loops/1-isolate/exercises/study.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "--defaults": { - ".js": "parsons" - }, - "parsons": { - "run": true, - "trace": true - } -} diff --git a/lesson-plans/for-loops/1-isolate/study.json b/lesson-plans/for-loops/1-isolate/study.json deleted file mode 100644 index c22a7cf..0000000 --- a/lesson-plans/for-loops/1-isolate/study.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "study": { - "openIn": "jsTutorLive" - } -} diff --git a/lesson-plans/for-loops/2-integrate/multiplication/index.html b/lesson-plans/for-loops/2-integrate/multiplication/index.html deleted file mode 100644 index 5ce8be1..0000000 --- a/lesson-plans/for-loops/2-integrate/multiplication/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -multiplication - - - - - -- - X - - - - - - diff --git a/lesson-plans/for-loops/2-integrate/multiplication/script.js b/lesson-plans/for-loops/2-integrate/multiplication/script.js deleted file mode 100644 index 24a3f3a..0000000 --- a/lesson-plans/for-loops/2-integrate/multiplication/script.js +++ /dev/null @@ -1,11 +0,0 @@ -import { readNumber, display } from '../../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user values - - // use a for loop to multiply the two numbers - - // display the product -}); diff --git a/lesson-plans/for-loops/2-integrate/multiplication/script.re.js b/lesson-plans/for-loops/2-integrate/multiplication/script.re.js deleted file mode 100644 index 28ef8dd..0000000 --- a/lesson-plans/for-loops/2-integrate/multiplication/script.re.js +++ /dev/null @@ -1,87 +0,0 @@ -const _0x22f7f9 = _0x21dc; -function _0x21dc(t, n) { - const r = _0xd99c(); - return (_0x21dc = function (t, n) { - return r[(t -= 483)]; - })(t, n); -} -!(function (t, n) { - const r = _0x21dc, - e = _0xd99c(); - for (;;) - try { - if ( - 508287 === - parseInt(r(505)) / 1 + - -parseInt(r(488)) / 2 + - parseInt(r(490)) / 3 + - parseInt(r(501)) / 4 + - parseInt(r(502)) / 5 + - -parseInt(r(491)) / 6 + - parseInt(r(492)) / 7 - ) - break; - e.push(e.shift()); - } catch (t) { - e.push(e.shift()); - } -})(); -import { readNumber, display } from '../../../../lib/dom-io.js'; -function _0xd99c() { - const t = [ - 'secret-sol', - 'left', - 'right', - 'ugzpR', - 'addEventLi', - '2667472duExbP', - '3677530THnZJl', - 'do-math', - 'getElement', - '161228isIzuf', - 'click', - 'DAQiV', - 'stener', - 'ById', - 'kSLmN', - 'ZThmD', - '1966374DvFfCi', - 'DIQyE', - '30264iRknoy', - '1468272UpOAFU', - '1137472zQdtzn', - 'ution', - 'gtvRI', - 'rUNle', - ]; - return (_0xd99c = function () { - return t; - })(); -} -document[_0x22f7f9(504) + _0x22f7f9(485)](_0x22f7f9(503))[ - _0x22f7f9(500) + _0x22f7f9(484) -](_0x22f7f9(506), () => { - const t = _0x22f7f9, - n = { - DAQiV: function (t, n) { - return t(n); - }, - ZThmD: t(497), - ugzpR: function (t, n) { - return t(n); - }, - DIQyE: t(498), - rUNle: function (t, n) { - return t < n; - }, - kSLmN: function (t, n, r) { - return t(n, r); - }, - gtvRI: t(496) + t(493), - }, - r = n[t(483)](readNumber, n[t(487)]), - e = n[t(499)](readNumber, n[t(489)]); - let f = 0; - for (let c = 0; n[t(495)](c, r); c++) f += e; - n[t(486)](display, n[t(494)], f); -}); diff --git a/lesson-plans/for-loops/2-integrate/repeat-characters/index.html b/lesson-plans/for-loops/2-integrate/repeat-characters/index.html deleted file mode 100644 index a7448f6..0000000 --- a/lesson-plans/for-loops/2-integrate/repeat-characters/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- - - -
- -your output: - - -
- -expected output: - -repeat characters - - - - - -- repeat each character in this string: - - - - - - diff --git a/lesson-plans/for-loops/2-integrate/repeat-characters/script.js b/lesson-plans/for-loops/2-integrate/repeat-characters/script.js deleted file mode 100644 index 9e4daaa..0000000 --- a/lesson-plans/for-loops/2-integrate/repeat-characters/script.js +++ /dev/null @@ -1,15 +0,0 @@ -import { readNumber, readString, display } from '../../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user values - - // repeat the characters in the text - - for (_; _; _) { - for (_; _; _) {} - } - - // display the text with repeated characters -}); diff --git a/lesson-plans/for-loops/2-integrate/repeat-characters/script.re.js b/lesson-plans/for-loops/2-integrate/repeat-characters/script.re.js deleted file mode 100644 index 05664c3..0000000 --- a/lesson-plans/for-loops/2-integrate/repeat-characters/script.re.js +++ /dev/null @@ -1,88 +0,0 @@ -const _0xb5d99f = _0x4e02; -function _0x4e02(t, e) { - const n = _0x5234(); - return (_0x4e02 = function (t, e) { - return n[(t -= 368)]; - })(t, e); -} -!(function (t, e) { - const n = _0x4e02, - r = _0x5234(); - for (;;) - try { - if ( - 341716 === - -parseInt(n(370)) / 1 + - (-parseInt(n(383)) / 2) * (-parseInt(n(377)) / 3) + - (-parseInt(n(379)) / 4) * (parseInt(n(368)) / 5) + - -parseInt(n(393)) / 6 + - -parseInt(n(374)) / 7 + - parseInt(n(382)) / 8 + - parseInt(n(384)) / 9 - ) - break; - r.push(r.shift()); - } catch (t) { - r.push(r.shift()); - } -})(); -import { readNumber, readString, display } from '../../../../lib/dom-io.js'; -function _0x5234() { - const t = [ - 'rtcHc', - 'getElement', - 'ution', - 'number-of-', - '2725032QpOYbz', - 'mFJTB', - '425SYBxQh', - 'SqVcC', - '526376xJqkeX', - 'repeat-the', - 'user-text', - 'times', - '2661981PpjoLg', - 'nawrc', - 'ById', - '21WvpjTa', - 'secret-sol', - '18412xgiVvn', - 'ECwVb', - 'addEventLi', - '3947208oksAHJ', - '604guowxK', - '14384583mFSAPe', - 'length', - 'click', - 'stener', - 'IZrFS', - ]; - return (_0x5234 = function () { - return t; - })(); -} -document[_0xb5d99f(390) + _0xb5d99f(376)](_0xb5d99f(371) + 'm')[ - _0xb5d99f(381) + _0xb5d99f(387) -](_0xb5d99f(386), () => { - const t = _0xb5d99f, - e = { - ECwVb: function (t, e) { - return t(e); - }, - SqVcC: t(372), - mFJTB: t(392) + t(373), - nawrc: function (t, e) { - return t < e; - }, - rtcHc: function (t, e, n) { - return t(e, n); - }, - IZrFS: t(378) + t(391), - }, - n = e[t(380)](readString, e[t(369)]), - r = e[t(380)](readNumber, e[t(394)]); - let c = ''; - for (let o = 0; e[t(375)](o, n[t(385)]); o++) - for (let s = 0; e[t(375)](s, r); s++) c += n[o]; - e[t(389)](display, e[t(388)], c); -}); diff --git a/lesson-plans/for-loops/2-integrate/repeat-string/index.html b/lesson-plans/for-loops/2-integrate/repeat-string/index.html deleted file mode 100644 index 0414db5..0000000 --- a/lesson-plans/for-loops/2-integrate/repeat-string/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -
- this many tines: -
- - - -
- -your output: - - -
- -expected output: - -repeat string - - - - - -- repeat this string: - - - - - diff --git a/lesson-plans/for-loops/2-integrate/repeat-string/script.js b/lesson-plans/for-loops/2-integrate/repeat-string/script.js deleted file mode 100644 index 1571d3f..0000000 --- a/lesson-plans/for-loops/2-integrate/repeat-string/script.js +++ /dev/null @@ -1,11 +0,0 @@ -import { readNumber, readString, display } from '../../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user values - - // repeat the string - - // display the repeated string -}); diff --git a/lesson-plans/for-loops/2-integrate/repeat-string/script.re.js b/lesson-plans/for-loops/2-integrate/repeat-string/script.re.js deleted file mode 100644 index 483804a..0000000 --- a/lesson-plans/for-loops/2-integrate/repeat-string/script.re.js +++ /dev/null @@ -1,87 +0,0 @@ -function _0x364d() { - const t = [ - 'addEventLi', - 'stener', - '19969050iXGEmW', - 'ution', - 'rlmtC', - '37176xDqwGw', - 'number-of-', - '15vEcczn', - 'ById', - '6921702YqBkwt', - '410862hKLsbi', - 'cVVnX', - '651ihODJx', - 'wXtXa', - 'secret-sol', - 'repeat-it', - '2506018COgcFU', - 'click', - '15963UiJIHi', - 'getElement', - 'gLqRE', - '544KDZhZk', - 'user-text', - '1221794wbCcAS', - 'eBpLS', - 'TUmrR', - 'times', - ]; - return (_0x364d = function () { - return t; - })(); -} -const _0x42f7a6 = _0x4d63; -!(function (t, n) { - const r = _0x4d63, - e = _0x364d(); - for (;;) - try { - if ( - 788096 === - -parseInt(r(419)) / 1 + - -parseInt(r(412)) / 2 + - (parseInt(r(414)) / 3) * (parseInt(r(417)) / 4) + - (-parseInt(r(403)) / 5) * (-parseInt(r(406)) / 6) + - (-parseInt(r(408)) / 7) * (parseInt(r(401)) / 8) + - parseInt(r(405)) / 9 + - parseInt(r(398)) / 10 - ) - break; - e.push(e.shift()); - } catch (t) { - e.push(e.shift()); - } -})(); -import { readNumber, readString, display } from '../../../../lib/dom-io.js'; -function _0x4d63(t, n) { - const r = _0x364d(); - return (_0x4d63 = function (t, n) { - return r[(t -= 398)]; - })(t, n); -} -document[_0x42f7a6(415) + _0x42f7a6(404)](_0x42f7a6(411))[ - _0x42f7a6(423) + _0x42f7a6(424) -](_0x42f7a6(413), () => { - const t = _0x42f7a6, - n = { - gLqRE: function (t, n) { - return t(n); - }, - wXtXa: t(418), - TUmrR: t(402) + t(422), - eBpLS: function (t, n) { - return t < n; - }, - rlmtC: function (t, n, r) { - return t(n, r); - }, - cVVnX: t(410) + t(399), - }, - r = n[t(416)](readString, n[t(409)]), - e = n[t(416)](readNumber, n[t(421)]); - let a = ''; - for (let i = 0; n[t(420)](i, e); i++) a += r; - n[t(400)](display, n[t(407)], a); -}); diff --git a/lesson-plans/for-loops/2-integrate/reverse-string/index.html b/lesson-plans/for-loops/2-integrate/reverse-string/index.html deleted file mode 100644 index 18a58b1..0000000 --- a/lesson-plans/for-loops/2-integrate/reverse-string/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -
- this many tines: -
- - - -
- -your output: - - -
- -expected output: - -reverse string - - - - - -- reverse this string: - - - - - diff --git a/lesson-plans/for-loops/2-integrate/reverse-string/script.js b/lesson-plans/for-loops/2-integrate/reverse-string/script.js deleted file mode 100644 index a4ec852..0000000 --- a/lesson-plans/for-loops/2-integrate/reverse-string/script.js +++ /dev/null @@ -1,11 +0,0 @@ -import { readString, display } from '../../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user text - - // use a for loop that counts down (i--) to reverse the input - - // display the reversed string -}); diff --git a/lesson-plans/for-loops/2-integrate/reverse-string/script.re.js b/lesson-plans/for-loops/2-integrate/reverse-string/script.re.js deleted file mode 100644 index bcabb2d..0000000 --- a/lesson-plans/for-loops/2-integrate/reverse-string/script.re.js +++ /dev/null @@ -1,88 +0,0 @@ -const _0x314480 = _0x370b; -function _0x3c24() { - const t = [ - 'RtJAe', - '2sGralD', - 'ution', - 'saDJo', - 'ById', - '11489488ZhWQBl', - 'reverse-it', - 'user-text', - 'PplZc', - '5554779kYUBJS', - 'length', - '504351VdYWlJ', - '30791057fMjkQa', - 'addEventLi', - 'TFJuj', - 'secret-sol', - '14DkCpAs', - '580632BfYZPy', - '60CGixJZ', - 'stener', - 'JojXJ', - '310esptOT', - 'getElement', - 'ruBFK', - '5543508jBnoNq', - '1398001ZOSIdc', - 'click', - ]; - return (_0x3c24 = function () { - return t; - })(); -} -!(function (t, n) { - const r = _0x370b, - e = _0x3c24(); - for (;;) - try { - if ( - 943114 === - -parseInt(r(272)) / 1 + - (parseInt(r(275)) / 2) * (parseInt(r(283)) / 3) + - (-parseInt(r(291)) / 4) * (-parseInt(r(292)) / 5) + - (-parseInt(r(271)) / 6) * (-parseInt(r(290)) / 7) + - parseInt(r(279)) / 8 + - (-parseInt(r(285)) / 9) * (parseInt(r(295)) / 10) + - -parseInt(r(286)) / 11 - ) - break; - e.push(e.shift()); - } catch (t) { - e.push(e.shift()); - } -})(); -import { readString, display } from '../../../../lib/dom-io.js'; -function _0x370b(t, n) { - const r = _0x3c24(); - return (_0x370b = function (t, n) { - return r[(t -= 269)]; - })(t, n); -} -document[_0x314480(269) + _0x314480(278)](_0x314480(280))[ - _0x314480(287) + _0x314480(293) -](_0x314480(273), () => { - const t = _0x314480, - n = { - ruBFK: function (t, n) { - return t(n); - }, - RtJAe: t(281), - PplZc: function (t, n) { - return t - n; - }, - JojXJ: function (t, n) { - return t >= n; - }, - TFJuj: function (t, n, r) { - return t(n, r); - }, - saDJo: t(289) + t(276), - }, - r = n[t(270)](readString, n[t(274)]); - let e = ''; - for (let s = n[t(282)](r[t(284)], 1); n[t(294)](s, 0); s--) e += r[s]; - n[t(288)](display, n[t(277)], e); -}); diff --git a/lesson-plans/for-loops/2-integrate/skip/index.html b/lesson-plans/for-loops/2-integrate/skip/index.html deleted file mode 100644 index 388d375..0000000 --- a/lesson-plans/for-loops/2-integrate/skip/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- -
- - - -
- -your output: - - -
- -expected output: - -skip - - - - - -- skip this many characters: - - - - - - diff --git a/lesson-plans/for-loops/2-integrate/skip/script.js b/lesson-plans/for-loops/2-integrate/skip/script.js deleted file mode 100644 index 16b8636..0000000 --- a/lesson-plans/for-loops/2-integrate/skip/script.js +++ /dev/null @@ -1,11 +0,0 @@ -import { readNumber, readString, display } from '../../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user values - - // create a new string with skipped characters - - // display the skipped string -}); diff --git a/lesson-plans/for-loops/2-integrate/skip/script.re.js b/lesson-plans/for-loops/2-integrate/skip/script.re.js deleted file mode 100644 index 423596b..0000000 --- a/lesson-plans/for-loops/2-integrate/skip/script.re.js +++ /dev/null @@ -1,92 +0,0 @@ -function _0x5b54(n, t) { - const e = _0x2a56(); - return (_0x5b54 = function (n, t) { - return e[(n -= 199)]; - })(n, t); -} -function _0x2a56() { - const n = [ - 'kHICf', - 'XwHbC', - 'skip-them', - 'VsvhF', - '5463430cRDskf', - '4KEeUAy', - '46258641CmQbjR', - 'kffQS', - '12807wJnILJ', - 'addEventLi', - '2152FsYdQN', - 'HioKn', - 'stener', - 'skip-size', - 'user-text', - '552588OsvZEs', - 'ById', - '49XuJxYZ', - '64xBKQGk', - 'Uubme', - 'secret-sol', - 'click', - 'ution', - 'BLjwT', - 'getElement', - '3964173urgyfO', - '13071740pCVQqY', - 'length', - '1721nGSSIv', - ]; - return (_0x2a56 = function () { - return n; - })(); -} -const _0x1c928d = _0x5b54; -!(function (n, t) { - const e = _0x5b54, - r = _0x2a56(); - for (;;) - try { - if ( - 690907 === - (-parseInt(e(224)) / 1) * (parseInt(e(214)) / 2) + - -parseInt(e(221)) / 3 + - (parseInt(e(201)) / 4) * (-parseInt(e(200)) / 5) + - (-parseInt(e(211)) / 6) * (-parseInt(e(213)) / 7) + - (-parseInt(e(206)) / 8) * (parseInt(e(204)) / 9) + - -parseInt(e(222)) / 10 + - parseInt(e(202)) / 11 - ) - break; - r.push(r.shift()); - } catch (n) { - r.push(r.shift()); - } -})(); -import { readNumber, readString, display } from '../../../../lib/dom-io.js'; -document[_0x1c928d(220) + _0x1c928d(212)](_0x1c928d(227))[ - _0x1c928d(205) + _0x1c928d(208) -](_0x1c928d(217), () => { - const n = _0x1c928d, - t = { - HioKn: function (n, t) { - return n(t); - }, - kffQS: n(210), - Uubme: n(209), - kHICf: function (n, t) { - return n < t; - }, - VsvhF: function (n, t) { - return n + t; - }, - BLjwT: function (n, t, e) { - return n(t, e); - }, - XwHbC: n(216) + n(218), - }, - e = t[n(207)](readString, t[n(203)]), - r = t[n(207)](readNumber, t[n(215)]); - let s = ''; - for (let c = 0; t[n(225)](c, e[n(223)]); c = t[n(199)](c, r)) s += e[c]; - t[n(219)](display, t[n(226)], s); -}); diff --git a/lesson-plans/for-loops/2-integrate/upside-down-pyramid/index.html b/lesson-plans/for-loops/2-integrate/upside-down-pyramid/index.html deleted file mode 100644 index 8ed1189..0000000 --- a/lesson-plans/for-loops/2-integrate/upside-down-pyramid/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- in this text: -
- - - -
- -your output: - - -
- -expected output: - -upside down pyramid - - - - - -- create an upside down pyramid with this text: - - - - - - - - diff --git a/lesson-plans/for-loops/2-integrate/upside-down-pyramid/script.js b/lesson-plans/for-loops/2-integrate/upside-down-pyramid/script.js deleted file mode 100644 index eb55fae..0000000 --- a/lesson-plans/for-loops/2-integrate/upside-down-pyramid/script.js +++ /dev/null @@ -1,15 +0,0 @@ -import { readString, display } from '../../../../lib/dom-io.js'; - -document.getElementById(__).addEventListener('click', () => { - debugger; - - // read user text - - // create the pyramid - - for (_; _; _) { - for (_; _; _) {} - } - - // display the pyramid -}); diff --git a/lesson-plans/for-loops/2-integrate/upside-down-pyramid/script.re.js b/lesson-plans/for-loops/2-integrate/upside-down-pyramid/script.re.js deleted file mode 100644 index 0bb42bc..0000000 --- a/lesson-plans/for-loops/2-integrate/upside-down-pyramid/script.re.js +++ /dev/null @@ -1,90 +0,0 @@ -const _0x249d7f = _0x517a; -function _0x517a(n, t) { - const r = _0x4fac(); - return (_0x517a = function (n, t) { - return r[(n -= 175)]; - })(n, t); -} -!(function (n, t) { - const r = _0x517a, - e = _0x4fac(); - for (;;) - try { - if ( - 641495 === - parseInt(r(193)) / 1 + - -parseInt(r(184)) / 2 + - (parseInt(r(195)) / 3) * (-parseInt(r(177)) / 4) + - (-parseInt(r(187)) / 5) * (parseInt(r(198)) / 6) + - parseInt(r(196)) / 7 + - parseInt(r(186)) / 8 + - (parseInt(r(199)) / 9) * (parseInt(r(178)) / 10) - ) - break; - e.push(e.shift()); - } catch (n) { - e.push(e.shift()); - } -})(); -import { readString, display } from '../../../../lib/dom-io.js'; -function _0x4fac() { - const n = [ - 'to-pyramid', - '3340072QrvFwP', - '50930pLpoKj', - 'ution', - 'ById', - 'secret-sol', - 'ccDch', - 'getElement', - '2424030gpGmyH', - 'addEventLi', - '9265040iFTJJE', - '1940910mgQmNz', - 'length', - 'aYXJC', - 'pyramid-it', - 'bqqNJ', - 'qeRNO', - '999977NCkfOA', - 'sdFYm', - '3wHpAjJ', - '3407684jOdLws', - 'stener', - '12KYhpIp', - '1449MydWXK', - 'mnVKk', - 'click', - ]; - return (_0x4fac = function () { - return n; - })(); -} -document[_0x249d7f(183) + _0x249d7f(180)](_0x249d7f(190))[ - _0x249d7f(185) + _0x249d7f(197) -](_0x249d7f(175), () => { - const n = _0x249d7f, - t = { - sdFYm: function (n, t) { - return n(t); - }, - ccDch: n(176), - qeRNO: function (n, t) { - return n < t; - }, - mnVKk: function (n, t) { - return n < t; - }, - aYXJC: function (n, t, r) { - return n(t, r); - }, - bqqNJ: n(181) + n(179), - }, - r = t[n(194)](readString, t[n(182)]); - let e = ''; - for (let c = 0; t[n(192)](c, r[n(188)]); c++) { - for (let a = c; t[n(200)](a, r[n(188)]); a++) e += r[a]; - e += '\n'; - } - t[n(189)](display, t[n(191)], e); -}); diff --git a/lesson-plans/for-loops/1-isolate/README.md b/lesson-plans/for-loops/README.md similarity index 82% rename from lesson-plans/for-loops/1-isolate/README.md rename to lesson-plans/for-loops/README.md index bdbbe24..eba0e67 100644 --- a/lesson-plans/for-loops/1-isolate/README.md +++ b/lesson-plans/for-loops/README.md @@ -16,7 +16,7 @@ conventionally used? ```js for (initialization; condition; finalExpression) { - // ... loop body ... + // ... loop body ... } ``` @@ -37,15 +37,15 @@ The correct answer is `2`: ```js for ( - // 2: declare and assign the `step` variable - let step = 0; // initialization - // 3, 6, 9, 12: check if `step` is less than 3 - step < 3; // condition - // 5, 8, 11: add 1 to `step` - step++ // finalExpression + // 2: declare and assign the `step` variable + let step = 0; // initialization + // 3, 6, 9, 12: check if `step` is less than 3 + step < 3; // condition + // 5, 8, 11: add 1 to `step` + step++ // finalExpression ) { - // 4, 7, 10: log the current value of `step` - console.log(step); + // 4, 7, 10: log the current value of `step` + console.log(step); } ``` @@ -74,14 +74,14 @@ let max = 3; let step = 0; // condition while (step < max) { - console.log(step); - // final expression - step = step + 1; + console.log(step); + // final expression + step = step + 1; } // initialization; condition; finalExpression for (let step = 0; step < max; step++) { - console.log(step); + console.log(step); } ``` @@ -91,7 +91,7 @@ _variables_ button): ```js for (let step = 0; step < 3; step++) { - console.log(step); + console.log(step); } step; // ReferenceError @@ -122,13 +122,13 @@ let totalRepetitions = 4; let repeatedString = ''; for (let i = 0; i < totalRepetitions; i++) { - repeatedString += toRepeat; - console.log('repeatedString:', repeatedString); + repeatedString += toRepeat; + console.log('repeatedString:', repeatedString); } console.assert( - repeatedString === 'howdyhowdyhowdyhowdy', - '"howdy" should be repeated 4 times', + repeatedString === 'howdyhowdyhowdyhowdy', + '"howdy" should be repeated 4 times', ); ``` @@ -149,14 +149,14 @@ let reversedString = ''; console.log('reversedString:', reversedString); for (_; _; _) { - let nextLetter = _; - reversedString = _ + _; - console.log('reversedString:', reversedString); + let nextLetter = _; + reversedString = _ + _; + console.log('reversedString:', reversedString); } console.assert( - reversedString === 'mlkj', - 'reversed string is the original reversed', + reversedString === 'mlkj', + 'reversed string is the original reversed', ); ``` diff --git a/lesson-plans/for-loops/1-isolate/examples/1-for-many-lines.js b/lesson-plans/for-loops/examples/1-for-many-lines.js similarity index 100% rename from lesson-plans/for-loops/1-isolate/examples/1-for-many-lines.js rename to lesson-plans/for-loops/examples/1-for-many-lines.js diff --git a/lesson-plans/for-loops/1-isolate/examples/2-for-one-line.js b/lesson-plans/for-loops/examples/2-for-one-line.js similarity index 100% rename from lesson-plans/for-loops/1-isolate/examples/2-for-one-line.js rename to lesson-plans/for-loops/examples/2-for-one-line.js diff --git a/lesson-plans/for-loops/1-isolate/examples/3-for-infinite.js b/lesson-plans/for-loops/examples/3-for-infinite.js similarity index 100% rename from lesson-plans/for-loops/1-isolate/examples/3-for-infinite.js rename to lesson-plans/for-loops/examples/3-for-infinite.js diff --git a/lesson-plans/for-loops/1-isolate/examples/4-iterating-over-strings.js b/lesson-plans/for-loops/examples/4-iterating-over-strings.js similarity index 100% rename from lesson-plans/for-loops/1-isolate/examples/4-iterating-over-strings.js rename to lesson-plans/for-loops/examples/4-iterating-over-strings.js diff --git a/lesson-plans/for-loops/1-isolate/examples/5-const.js b/lesson-plans/for-loops/examples/5-const.js similarity index 100% rename from lesson-plans/for-loops/1-isolate/examples/5-const.js rename to lesson-plans/for-loops/examples/5-const.js diff --git a/lesson-plans/for-loops/1-isolate/exercises/count-to-10-in-5-steps.js b/lesson-plans/for-loops/exercises/count-to-10-in-5-steps.js similarity index 100% rename from lesson-plans/for-loops/1-isolate/exercises/count-to-10-in-5-steps.js rename to lesson-plans/for-loops/exercises/count-to-10-in-5-steps.js diff --git a/lesson-plans/for-loops/1-isolate/exercises/loop-head-syntax.js b/lesson-plans/for-loops/exercises/loop-head-syntax.js similarity index 100% rename from lesson-plans/for-loops/1-isolate/exercises/loop-head-syntax.js rename to lesson-plans/for-loops/exercises/loop-head-syntax.js diff --git a/lesson-plans/for-loops/1-isolate/exercises/reverse-a-string.js b/lesson-plans/for-loops/exercises/reverse-a-string.js similarity index 100% rename from lesson-plans/for-loops/1-isolate/exercises/reverse-a-string.js rename to lesson-plans/for-loops/exercises/reverse-a-string.js diff --git a/lesson-plans/for-loops/exercises/study.json b/lesson-plans/for-loops/exercises/study.json new file mode 100644 index 0000000..71e7a1a --- /dev/null +++ b/lesson-plans/for-loops/exercises/study.json @@ -0,0 +1,9 @@ +{ + "--defaults": { + ".js": "parsons" + }, + "parsons": { + "run": true, + "trace": true + } +} diff --git a/lesson-plans/for-loops/1-isolate/for-loop-diagram.jpeg b/lesson-plans/for-loops/for-loop-diagram.jpeg similarity index 100% rename from lesson-plans/for-loops/1-isolate/for-loop-diagram.jpeg rename to lesson-plans/for-loops/for-loop-diagram.jpeg diff --git a/lesson-plans/for-loops/study.json b/lesson-plans/for-loops/study.json index 5cc5df1..e37e9a9 100644 --- a/lesson-plans/for-loops/study.json +++ b/lesson-plans/for-loops/study.json @@ -1,5 +1,5 @@ { - "study": { - "trace": false - } + "study": { + "openIn": "jsTutorLive" + } } diff --git a/lesson-plans/functional-array-methods/1-array-strategies/examples/study.json b/lesson-plans/functional-array-methods/1-array-strategies/examples/study.json index bddfb01..af9dc0d 100644 --- a/lesson-plans/functional-array-methods/1-array-strategies/examples/study.json +++ b/lesson-plans/functional-array-methods/1-array-strategies/examples/study.json @@ -1,5 +1,5 @@ { - "study": { - "openIn": true - } + "study": { + "openIn": true + } } diff --git a/lesson-plans/functional-array-methods/3-functional-array-methods/examples/study.json b/lesson-plans/functional-array-methods/3-functional-array-methods/examples/study.json index bddfb01..af9dc0d 100644 --- a/lesson-plans/functional-array-methods/3-functional-array-methods/examples/study.json +++ b/lesson-plans/functional-array-methods/3-functional-array-methods/examples/study.json @@ -1,5 +1,5 @@ { - "study": { - "openIn": true - } + "study": { + "openIn": true + } } diff --git a/lesson-plans/functional-array-methods/3-functional-array-methods/exercises/study.json b/lesson-plans/functional-array-methods/3-functional-array-methods/exercises/study.json index 3125020..0dbe924 100644 --- a/lesson-plans/functional-array-methods/3-functional-array-methods/exercises/study.json +++ b/lesson-plans/functional-array-methods/3-functional-array-methods/exercises/study.json @@ -1,9 +1,9 @@ { - "study": { - "openIn": false, - "ask": false, - "trace": false, - "type": "module", - "environment": true - } + "study": { + "openIn": false, + "ask": false, + "trace": false, + "type": "module", + "environment": true + } } diff --git a/lesson-plans/functional-array-methods/study.json b/lesson-plans/functional-array-methods/study.json index c22a7cf..e37e9a9 100644 --- a/lesson-plans/functional-array-methods/study.json +++ b/lesson-plans/functional-array-methods/study.json @@ -1,5 +1,5 @@ { - "study": { - "openIn": "jsTutorLive" - } + "study": { + "openIn": "jsTutorLive" + } } diff --git a/lesson-plans/functions-and-unit-testing/3-testing-functions/study.json b/lesson-plans/functions-and-unit-testing/3-testing-functions/study.json index 6669ed5..55911c5 100644 --- a/lesson-plans/functions-and-unit-testing/3-testing-functions/study.json +++ b/lesson-plans/functions-and-unit-testing/3-testing-functions/study.json @@ -1,11 +1,11 @@ { - "study": { - "ask": false, - "trace": false, - "flowchart": false, - "variables": false, - "blanks": false, - "eslint": false, - "openIn": false - } + "study": { + "ask": false, + "trace": false, + "flowchart": false, + "variables": false, + "blanks": false, + "eslint": false, + "openIn": false + } } diff --git a/lesson-plans/functions-and-unit-testing/study.json b/lesson-plans/functions-and-unit-testing/study.json index 5c9322f..1dd55c8 100644 --- a/lesson-plans/functions-and-unit-testing/study.json +++ b/lesson-plans/functions-and-unit-testing/study.json @@ -1,8 +1,8 @@ { - "study": { - "openIn": true, - "ask": { - "levels": [1, 2, 3, 4] - } - } + "study": { + "openIn": true, + "ask": { + "levels": [1, 2, 3, 4] + } + } } diff --git a/lesson-plans/group-project-intro/README.md b/lesson-plans/group-project-intro/README.md index 06e8d1d..3ff19eb 100644 --- a/lesson-plans/group-project-intro/README.md +++ b/lesson-plans/group-project-intro/README.md @@ -1,8 +1,21 @@ # Group Project Intro In this class you'll study the starter repository for the -[Numbers Group Project](https://github.com/HackYourFutureBelgium/numbers-group-project), -form small groups (3-4) and prepare for the week's deliverable.. +[Numbers Group Project](https://github.com/DeNepo/numbers-group-project), form +small groups (3-4) and prepare for the week's deliverable.. + +--- + +## Prep Work + +- Come prepared to use object dot notation: + - Reading a key/value pair: `obj.key` + - Writing a key/value pair: `obj.key = __` +- Practice opening and stepping through the examples in + `/10-multiple-interactions`. (any one will do, you can study the rest in + class) + +--- ## Learning Objectives @@ -47,13 +60,13 @@ To prepare for the group project you can: - Try making small changes and seeing what happens! - _All Together_: Read through the - [Numbers Group Project](https://github.com/HackYourFutureBelgium/numbers-group-project) + [Numbers Group Project](https://github.com/DeNepo/numbers-group-project) repository. - What code is already complete? - What code will you need to write over the week? - Demo how to run the scripts in `package.json` - _Small Groups_: Form random groups of 3-4 people and prepare for the week. - Set up a group repository from the - [project template](https://github.com/HackYourFutureBelgium/numbers-group-project) + [project template](https://github.com/DeNepo/numbers-group-project) - Practice running the `package.json` scripts on your local computers - Create a project board with one issue per user interaction diff --git a/lesson-plans/group-project-intro/examples/cat-advice/index.html b/lesson-plans/group-project-intro/examples/cat-advice/index.html deleted file mode 100644 index 7e84b0b..0000000 --- a/lesson-plans/group-project-intro/examples/cat-advice/index.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - -
- - - -
- -your output: - - -
- -expected output: - -cat advice - - - - - -- i like cats: - - - - diff --git a/lesson-plans/group-project-intro/examples/cat-advice/src/give-advice.js b/lesson-plans/group-project-intro/examples/cat-advice/src/give-advice.js deleted file mode 100644 index c2d45ca..0000000 --- a/lesson-plans/group-project-intro/examples/cat-advice/src/give-advice.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readBoolean, display } from '../../../../../lib/dom-io.js'; - -import { catAdvisor } from './utils/cat-advisor.js'; - -// once when the script is loaded -debugger; - -// declare the function to call each time a user clicks -const giveAdvice = () => { - // each time the user interacts - debugger; - - // read the user's boolean input from the UI - - const likesCats = readBoolean('likes-cats'); - const isAllergic = readBoolean('is-allergic'); - const ownsOne = readBoolean('owns-one'); - - // generate good advice - - const advice = catAdvisor(likesCats, isAllergic, ownsOne); - - // share your advice with the user - - display('message', advice); -}; - -// attach the event listener to call the function each time the user clicks -document.getElementById('give-advice').addEventListener('click', giveAdvice); diff --git a/lesson-plans/group-project-intro/examples/cat-advice/src/utils/cat-advisor.js b/lesson-plans/group-project-intro/examples/cat-advice/src/utils/cat-advisor.js deleted file mode 100644 index 5c2d269..0000000 --- a/lesson-plans/group-project-intro/examples/cat-advice/src/utils/cat-advisor.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * @param {boolean} likesCats - * @param {boolean} isAllergic - * @param {boolean} ownsOne - * @returns {boolean} - */ -export const catAdvisor = (likesCats, isAllergic, ownsOne) => { - debugger; - return likesCats && isAllergic && ownsOne - ? 'replace your cat with a stuffed animal' - : likesCats && isAllergic && !ownsOne - ? 'make a friend who has a cat' - : likesCats && !isAllergic && ownsOne - ? 'you are doing great' - : likesCats && !isAllergic && !ownsOne - ? 'get a cat' - : !likesCats && isAllergic && ownsOne - ? 'rethink your life choices' - : !likesCats && isAllergic && !ownsOne - ? 'you are doing great' - : !likesCats && !isAllergic && ownsOne - ? 'you could be doing worse' - : // !likesCats && !isAllergic && !ownsOne - 'you are doing great'; -}; diff --git a/lesson-plans/group-project-intro/examples/sort-numbers/index.html b/lesson-plans/group-project-intro/examples/sort-numbers/index.html deleted file mode 100644 index 41e962f..0000000 --- a/lesson-plans/group-project-intro/examples/sort-numbers/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -
- i am allergic to cats:
- i own a cat:
- - - -
- - -sort numbers - - - - - -- - - - - - - - - - diff --git a/lesson-plans/group-project-intro/examples/sort-numbers/src/add-number.js b/lesson-plans/group-project-intro/examples/sort-numbers/src/add-number.js deleted file mode 100644 index 6d71012..0000000 --- a/lesson-plans/group-project-intro/examples/sort-numbers/src/add-number.js +++ /dev/null @@ -1,30 +0,0 @@ -import { data } from '../data.js'; - -import { readNumber, display } from '../../../../../lib/dom-io.js'; - -// once when the page is loaded -debugger; - -const addNumber = () => { - // each time the user does this - debugger; - - // --- read user input --- - - const newNumber = readNumber('the-num'); - - // --- update shared data --- - - data.numbers.push(newNumber); - - // --- use shared data to update the UI --- - - let numbersList = ''; - for (const num of data.numbers) { - numbersList += `* ${num}\n`; - } - display('all-numbers', numbersList); -}; - -// tell the browser to call your function each time the user interacts -document.getElementById('add-it').addEventListener('click', addNumber); diff --git a/lesson-plans/group-project-intro/examples/sort-numbers/src/sort-numbers.js b/lesson-plans/group-project-intro/examples/sort-numbers/src/sort-numbers.js deleted file mode 100644 index 0c72f4c..0000000 --- a/lesson-plans/group-project-intro/examples/sort-numbers/src/sort-numbers.js +++ /dev/null @@ -1,37 +0,0 @@ -import { data } from '../data.js'; - -import { readSelection, display } from '../../../../../lib/dom-io.js'; - -import { sort } from './utils/sort.js'; - -// once when the page is loaded -debugger; - -const sortNumbers = () => { - // each time the user does this - debugger; - - // --- read user input --- - - const sortType = readSelection('sort-type'); - - // --- read stored data to create a sorted list --- - - const sortedNumbers = - sortType === 'none' - ? data.numbers - : sortType === 'up' - ? sort(data.numbers, true) - : sort(data.numbers, false); - - // --- use shared data to update the UI --- - - let numbersList = ''; - for (const num of sortedNumbers) { - numbersList += `* ${num}\n`; - } - display('all-numbers', numbersList); -}; - -// tell the browser to call your function each time the user interacts -document.getElementById('sort-type').addEventListener('change', sortNumbers); diff --git a/lesson-plans/group-project-intro/examples/welcome/index.html b/lesson-plans/group-project-intro/examples/welcome/index.html deleted file mode 100644 index 482eb5a..0000000 --- a/lesson-plans/group-project-intro/examples/welcome/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - -
- -sort the numbers:
- - -
- - -welcome - - - - - -- first: - - - - - - - diff --git a/lesson-plans/group-project-intro/examples/welcome/src/change-first.js b/lesson-plans/group-project-intro/examples/welcome/src/change-first.js deleted file mode 100644 index c4eb1b5..0000000 --- a/lesson-plans/group-project-intro/examples/welcome/src/change-first.js +++ /dev/null @@ -1,29 +0,0 @@ -import { data } from '../data.js'; - -import { readString, display } from '../../../../../lib/dom-io.js'; - -import { greet } from './utils/greet.js'; - -// once when the page is loaded -debugger; - -const changeFirst = () => { - // each time the user does this - debugger; - - // --- read user input --- - - const newFirst = readString('first-name'); - - // --- update shared data --- - - data.first = newFirst; - - // --- use shared data to update the UI --- - - const newGreeting = greet(data.first, data.last); - display('greeting', newGreeting); -}; - -// tell the browser to call your function each time the user interacts -document.getElementById('first-name').addEventListener('input', changeFirst); diff --git a/lesson-plans/group-project-intro/examples/welcome/src/change-last.js b/lesson-plans/group-project-intro/examples/welcome/src/change-last.js deleted file mode 100644 index 0e2a0f8..0000000 --- a/lesson-plans/group-project-intro/examples/welcome/src/change-last.js +++ /dev/null @@ -1,29 +0,0 @@ -import { data } from '../data.js'; - -import { readString, display } from '../../../../../lib/dom-io.js'; - -import { greet } from './utils/greet.js'; - -// once when the page is loaded -debugger; - -const changeLast = () => { - // each time the user does this - debugger; - - // --- read user input --- - - const newLast = readString('last-name'); - - // --- update shared data --- - - data.last = newLast; - - // --- use shared data to update the UI --- - - const newGreeting = greet(data.first, data.last); - display('greeting', newGreeting); -}; - -// tell the browser to call your function each time the user interacts -document.getElementById('last-name').addEventListener('input', changeLast); diff --git a/lesson-plans/group-project-intro/examples/welcome/src/utils/greet.js b/lesson-plans/group-project-intro/examples/welcome/src/utils/greet.js deleted file mode 100644 index 8205795..0000000 --- a/lesson-plans/group-project-intro/examples/welcome/src/utils/greet.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -export const greet = (first = '', last = '') => { - // create the empty greeting - let greeting = 'Welcome'; - - // render the first name if one was passed - if (first !== '') { - greeting += ' ' + first; - } - - // render the last name if one was passed - if (last !== '') { - greeting += ' ' + last; - } - - // return an excited greeting - return greeting + '!'; -}; diff --git a/lesson-plans/group-project-intro/examples/welcome/src/utils/greet.spec.js b/lesson-plans/group-project-intro/examples/welcome/src/utils/greet.spec.js deleted file mode 100644 index 47e3d3d..0000000 --- a/lesson-plans/group-project-intro/examples/welcome/src/utils/greet.spec.js +++ /dev/null @@ -1,16 +0,0 @@ -import { greet } from './greet.js'; - -describe('greet: creates a greeting from a first and last name', () => { - it('says "Welcome!" when no names are passed', () => { - expect(greet('', '')).toEqual('Welcome!'); - }); - it('says "Welcome
- - last: - -
- -Welcome!
-!" when only a first name is passed', () => { - expect(greet('Java', '')).toEqual('Welcome Java!'); - }); - it('says "Welcome !" when only a last name is passed', () => { - expect(greet('', 'Script')).toEqual('Welcome Script!'); - }); - it('says "Welcome !" when both names are passed', () => { - expect(greet('Java', 'Script')).toEqual('Welcome Java Script!'); - }); -}); diff --git a/lesson-plans/group-project-intro/study.json b/lesson-plans/group-project-intro/study.json deleted file mode 100644 index 8aa7775..0000000 --- a/lesson-plans/group-project-intro/study.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "--defaults": { - ".md": "study" - }, - "study": { - "type": "module", - "environment": true, - "flowchart": false, - "variables": false, - "blanks": false, - "trace": false, - "ask": false, - "eslint": false - } -} diff --git a/lesson-plans/side-effects/study.json b/lesson-plans/side-effects/study.json index bddfb01..af9dc0d 100644 --- a/lesson-plans/side-effects/study.json +++ b/lesson-plans/side-effects/study.json @@ -1,5 +1,5 @@ { - "study": { - "openIn": true - } + "study": { + "openIn": true + } } diff --git a/lesson-plans/study.json b/lesson-plans/study.json index 734fe78..bcb1bc9 100644 --- a/lesson-plans/study.json +++ b/lesson-plans/study.json @@ -1,5 +1,5 @@ { - "--defaults": { - ".md": "slides" - } + "--defaults": { + ".md": "slides" + } } diff --git a/lesson-plans/util-functions/1-primitives/examples/reverse-something/index.html b/lesson-plans/util-functions/1-primitives/examples/reverse-something/index.html deleted file mode 100644 index e5f77b7..0000000 --- a/lesson-plans/util-functions/1-primitives/examples/reverse-something/index.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - reverse something - - - - - -- your text: - - - - - diff --git a/lesson-plans/util-functions/1-primitives/examples/reverse-something/src/reverse-input.js b/lesson-plans/util-functions/1-primitives/examples/reverse-something/src/reverse-input.js deleted file mode 100644 index 03f4d8c..0000000 --- a/lesson-plans/util-functions/1-primitives/examples/reverse-something/src/reverse-input.js +++ /dev/null @@ -1,18 +0,0 @@ -import { readString, display } from '../../../../../../lib/dom-io.js'; - -import { reverse } from './utils/reverse.js'; - -const reverseInput = () => { - debugger; - - // read user's input - const userText = readString('user-text'); - - // reverse the user's input - const backwards = reverse(userText); - - // display the backwards input to the user - display('reversed-output', backwards); -}; - -document.getElementById('reverse-all').addEventListener('click', reverseInput); diff --git a/lesson-plans/util-functions/1-primitives/examples/reverse-something/src/reverse-words.js b/lesson-plans/util-functions/1-primitives/examples/reverse-something/src/reverse-words.js deleted file mode 100644 index a9cedf4..0000000 --- a/lesson-plans/util-functions/1-primitives/examples/reverse-something/src/reverse-words.js +++ /dev/null @@ -1,31 +0,0 @@ -import { readString, display } from '../../../../../../lib/dom-io.js'; - -import { reverse } from './utils/reverse.js'; - -const reverseWords = () => { - debugger; - - // read user's input - const userText = readString('user-text'); - - // convert the input to an array of strings - // split the string at each space, removing the spaces - const userWords = userText.split(' '); - - // reverse each word in the input - // create a new array with the backwards words - const backwardsWords = []; - for (const word of userWords) { - const nextBackwards = reverse(word); - backwardsWords.push(nextBackwards); - } - - // create a string from the array of backwards words - // separate each item by a space - const backwards = backwardsWords.join(' '); - - // display the backwards input to the user - display('reversed-output', backwards); -}; - -document.getElementById('reverse-each').addEventListener('click', reverseWords); diff --git a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/demo.re.js b/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/demo.re.js deleted file mode 100644 index 49e8289..0000000 --- a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/demo.re.js +++ /dev/null @@ -1,237 +0,0 @@ -const _0x2d7107 = _0x3708; -function _0x3708(_0xf523ae, _0x513d89) { - const _0x1a5121 = _0x1a51(); - return ( - (_0x3708 = function (_0x37087a, _0x1893f0) { - _0x37087a = _0x37087a - 0x19c; - let _0x10c353 = _0x1a5121[_0x37087a]; - return _0x10c353; - }), - _0x3708(_0xf523ae, _0x513d89) - ); -} -(function (_0x376ac4, _0x19a403) { - const _0x48a108 = _0x3708, - _0x319f3d = _0x376ac4(); - while (!![]) { - try { - const _0x5b568b = - (parseInt(_0x48a108(0x1c5)) / 0x1) * - (-parseInt(_0x48a108(0x1ba)) / 0x2) + - parseInt(_0x48a108(0x1cf)) / 0x3 + - (parseInt(_0x48a108(0x1c4)) / 0x4) * - (parseInt(_0x48a108(0x1a8)) / 0x5) + - (parseInt(_0x48a108(0x1b1)) / 0x6) * - (-parseInt(_0x48a108(0x1b0)) / 0x7) + - parseInt(_0x48a108(0x19e)) / 0x8 + - -parseInt(_0x48a108(0x1a4)) / 0x9 + - (-parseInt(_0x48a108(0x1ae)) / 0xa) * - (-parseInt(_0x48a108(0x1bc)) / 0xb); - if (_0x5b568b === _0x19a403) break; - else _0x319f3d['push'](_0x319f3d['shift']()); - } catch (_0x408801) { - _0x319f3d['push'](_0x319f3d['shift']()); - } - } -})(_0x1a51, 0x19fde); -function _0x1a51() { - const _0x3f7696 = [ - '68154hxlNKA', - 'type', - 'BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz', - 'join', - 'length', - 'value', - '\x0a-\x20', - 'time', - 'try\x20using\x20one\x20of\x20these\x20types\x20instead:\x0a-\x20', - '242912LIDYUe', - 'checkbox', - '31482CRYNRd', - 'string', - 'includes', - '\x20is\x20not\x20for\x20displaying\x20data\x0a', - 'range', - 'password', - 'tel', - 'these', - '81996XNBBIH', - '1tqcsTi', - 'to-remove', - 'week', - 'SELECT', - 'getElementById', - 'color', - 'consonants', - 'secret-solution', - 'date', - '-\x20or\x20changing\x20it\x20to\x20a\x20different\x20element\x20or\x20input\x20type', - '477675fdwFih', - 'aeiouAEIOu', - 'there\x20is\x20no\x20element\x20with\x20id\x20\x22', - '\x20is\x20not\x20an\x20\x20element', - 'hidden', - 'click', - 'replaceAll', - 'url', - '288480AXBUCb', - 'text', - 'id\x20is\x20not\x20a\x20string\x20(first\x20argument)', - 'no\x20arg', - 'input', - 'number', - '949275oLTVHm', - 'you\x20did\x20not\x20pass\x20an\x20element\x20id\x20(first\x20argument)', - 'vowels', - 'nodeName', - '5JDBAEb', - 'innerHTML', - 'INPUT', - 'addEventListener', - 'toLowerCase', - 'datetime-local', - '530kMwiHm', - 'strings', - '21jVvnge', - ]; - _0x1a51 = function () { - return _0x3f7696; - }; - return _0x1a51(); -} -{ - const STRING_INPUTS = [ - _0x2d7107(0x19f), - 'email', - _0x2d7107(0x1c1), - 'search', - 'radio', - _0x2d7107(0x19d), - _0x2d7107(0x1c2), - _0x2d7107(0x1cd), - _0x2d7107(0x1b8), - 'month', - _0x2d7107(0x1c7), - _0x2d7107(0x1ad), - _0x2d7107(0x1ca), - _0x2d7107(0x1d3), - ], - BOOLEAN_INPUTS = [_0x2d7107(0x1bb)], - NUMBER_INPUTS = [_0x2d7107(0x1a3), _0x2d7107(0x1c0)], - NO_ARG = Symbol(_0x2d7107(0x1a1)), - NO_ID = _0x2d7107(0x1a5), - INVALID_ID = _0x2d7107(0x1a0), - wrongInputMessage = ({ - type: type = _0x2d7107(0x1af), - id: id = '', - allowed: allowed = [], - name: name = _0x2d7107(0x1a2), - }) => - '' + - name[_0x2d7107(0x1ac)]() + - (id ? '#' + id : '') + - '\x20is\x20not\x20for\x20' + - type + - '.\x0a' + - (allowed && allowed[_0x2d7107(0x1b5)] > 0x0 - ? _0x2d7107(0x1b9) + allowed[_0x2d7107(0x1b4)](_0x2d7107(0x1b7)) - : '') + - '\x0a', - readString = (_0x453fde = NO_ARG) => { - const _0x1a8330 = _0x2d7107; - if (_0x453fde === NO_ARG) throw new Error(NO_ID); - if (typeof _0x453fde !== _0x1a8330(0x1bd)) - throw new TypeError(INVALID_ID); - const _0x338944 = document[_0x1a8330(0x1c9)](_0x453fde); - if (_0x338944 === null) - throw new Error(_0x1a8330(0x1d1) + _0x453fde + '\x22'); - if (_0x338944[_0x1a8330(0x1a7)] !== 'INPUT') - throw new TypeError( - _0x338944['nodeName'][_0x1a8330(0x1ac)]() + - '#' + - _0x453fde + - _0x1a8330(0x1d2), - ); - if (!STRING_INPUTS['includes'](_0x338944[_0x1a8330(0x1b2)])) - throw new TypeError( - wrongInputMessage({ - allowed: STRING_INPUTS, - name: _0x338944['nodeName'], - id: _0x338944['id'], - }), - ); - return _0x338944[_0x1a8330(0x1b6)] || ''; - }, - display = (_0x21148e = NO_ARG, _0x21e84d = NO_ARG) => { - const _0x5c88cf = _0x2d7107; - if (_0x21148e === NO_ARG) throw new Error(NO_ID); - if (typeof _0x21148e !== _0x5c88cf(0x1bd)) - throw new TypeError(INVALID_ID); - if (_0x21e84d === NO_ARG) - throw new Error( - 'you\x20did\x20not\x20pass\x20a\x20value\x20to\x20display\x20(second\x20argument)', - ); - const _0x56d883 = document[_0x5c88cf(0x1c9)](_0x21148e); - if (_0x56d883 === null) - throw new Error(_0x5c88cf(0x1d1) + _0x21148e + '\x22'); - if ( - _0x56d883[_0x5c88cf(0x1a7)] === 'OPTION' || - _0x56d883[_0x5c88cf(0x1a7)] === _0x5c88cf(0x1c8) || - (_0x56d883[_0x5c88cf(0x1a7)] === _0x5c88cf(0x1aa) && - (STRING_INPUTS[_0x5c88cf(0x1be)](_0x56d883['type']) || - BOOLEAN_INPUTS[_0x5c88cf(0x1be)](_0x56d883['type']) || - NUMBER_INPUTS[_0x5c88cf(0x1be)](_0x56d883['type']))) - ) - throw new Error( - _0x56d883[_0x5c88cf(0x1a7)] + - '#' + - _0x21148e + - _0x5c88cf(0x1bf) + - '-\x20try\x20using\x20a\x20\x22set\x22\x20function\x20to\x20update\x20it\x27s\x20value' + - _0x5c88cf(0x1ce), - ); - _0x56d883[_0x5c88cf(0x1a9)] = _0x21e84d; - }, - removeCharacters = (_0x21f87b = '', _0x24a6a4 = '') => { - const _0x5a6f6d = _0x2d7107; - let _0x20fbdf = _0x21f87b; - for (const _0x10cef4 of _0x24a6a4) { - _0x20fbdf = _0x20fbdf[_0x5a6f6d(0x19c)](_0x10cef4, ''); - } - return _0x20fbdf; - }, - removeConsonants = () => { - const _0x37e796 = _0x2d7107; - debugger; - const _0x24dae6 = readString('user-text'), - _0x51a878 = removeCharacters(_0x24dae6, _0x37e796(0x1b3)); - display(_0x37e796(0x1cc), _0x51a878); - }; - document['getElementById'](_0x2d7107(0x1cb))['addEventListener']( - _0x2d7107(0x1d4), - removeConsonants, - ); - const removeThese = () => { - const _0x32ab13 = _0x2d7107; - debugger; - const _0x49428d = readString('user-text'), - _0x252db9 = readString(_0x32ab13(0x1c6)), - _0x4f4dea = removeCharacters(_0x49428d, _0x252db9); - display(_0x32ab13(0x1cc), _0x4f4dea); - }; - document[_0x2d7107(0x1c9)](_0x2d7107(0x1c3))[_0x2d7107(0x1ab)]( - 'click', - removeThese, - ); - const removeVowels = () => { - const _0x463f37 = _0x2d7107; - debugger; - const _0x2970d1 = readString('user-text'), - _0x5f3946 = removeCharacters(_0x2970d1, _0x463f37(0x1d0)); - display('secret-solution', _0x5f3946); - }; - document[_0x2d7107(0x1c9)](_0x2d7107(0x1a6))[_0x2d7107(0x1ab)]( - 'click', - removeVowels, - ); -} diff --git a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/index.html b/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/index.html deleted file mode 100644 index aa1df43..0000000 --- a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - -
- - - - -
- - -remove something - - - - - -- your text: - - - - - - - - - - diff --git a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/src/remove-consonants.js b/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/src/remove-consonants.js deleted file mode 100644 index 7d23d11..0000000 --- a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/src/remove-consonants.js +++ /dev/null @@ -1,21 +0,0 @@ -import { readString, display } from '../../../../../../../lib/dom-io.js'; - -import { removeCharacters } from './utils/remove-characters.js'; - -const removeConsonants = () => { - debugger; - - // --- read user input --- - const userText = readString('user-text'); - - // --- remove all consonants from the input --- - // use `removeCharacters` to write this step of the program - ___; - - // --- display the input with no consonants --- - display('removified', noConsonants); -}; - -document - .getElementById('consonants') - .addEventListener('click', removeConsonants); diff --git a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/src/remove-these.js b/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/src/remove-these.js deleted file mode 100644 index b5745db..0000000 --- a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/src/remove-these.js +++ /dev/null @@ -1,20 +0,0 @@ -import { readString, display } from '../../../../../../../lib/dom-io.js'; - -import { removeCharacters } from './utils/remove-characters.js'; - -const removeThese = () => { - debugger; - - // --- read user input --- - const userText = readString('user-text'); - const removeThese = readString('to-remove'); - - // remove all the user's characters from the input - // use `removeCharacters` to write this step of the program - ___; - - // --- display the input with no consonants --- - display('removified', noConsonants); -}; - -document.getElementById('these').addEventListener('click', removeThese); diff --git a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/src/remove-vowels.js b/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/src/remove-vowels.js deleted file mode 100644 index e70e5df..0000000 --- a/lesson-plans/util-functions/1-primitives/exercises/1-call-function/remove-characters/src/remove-vowels.js +++ /dev/null @@ -1,19 +0,0 @@ -import { readString, display } from '../../../../../../../lib/dom-io.js'; - -import { removeCharacters } from './utils/remove-characters.js'; - -const removeVowels = () => { - debugger; - - // --- read user input --- - const userText = readString('user-text'); - - // --- remove all vowels from the input --- - // use `removeCharacters` to write this step of the program - ___; - - // --- display the input with no vowels --- - display('removified', noVowels); -}; - -document.getElementById('vowels').addEventListener('click', removeVowels); diff --git a/lesson-plans/util-functions/1-primitives/exercises/2-write-function/palindrome-detector/index.html b/lesson-plans/util-functions/1-primitives/exercises/2-write-function/palindrome-detector/index.html deleted file mode 100644 index 8037ca4..0000000 --- a/lesson-plans/util-functions/1-primitives/exercises/2-write-function/palindrome-detector/index.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -
- - -
- -
- - - -
- - - your output: - - -
- - - demo output: - -palindrome detector - - - - - -- - - - - diff --git a/lesson-plans/util-functions/1-primitives/exercises/2-write-function/palindrome-detector/styles.css b/lesson-plans/util-functions/1-primitives/exercises/2-write-function/palindrome-detector/styles.css deleted file mode 100644 index 3dd5962..0000000 --- a/lesson-plans/util-functions/1-primitives/exercises/2-write-function/palindrome-detector/styles.css +++ /dev/null @@ -1,22 +0,0 @@ -.full { - height: 100vh; - width: 100vw; -} - -.centered { - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - text-align: center; -} - -.palindrome { - background: green; - color: black; -} - -.not-palindrome { - background: black; - color: white; -} diff --git a/lesson-plans/util-functions/1-primitives/exercises/3-refactor-function/reverse-something/demo.re.js b/lesson-plans/util-functions/1-primitives/exercises/3-refactor-function/reverse-something/demo.re.js deleted file mode 100644 index f719f38..0000000 --- a/lesson-plans/util-functions/1-primitives/exercises/3-refactor-function/reverse-something/demo.re.js +++ /dev/null @@ -1,240 +0,0 @@ -const _0x1410a1 = _0x15ff; -(function (_0xf56471, _0x261cac) { - const _0x1b32e1 = _0x15ff, - _0x50c906 = _0xf56471(); - while (!![]) { - try { - const _0x5756ef = - (-parseInt(_0x1b32e1(0x1fe)) / 0x1) * - (-parseInt(_0x1b32e1(0x211)) / 0x2) + - (parseInt(_0x1b32e1(0x215)) / 0x3) * - (-parseInt(_0x1b32e1(0x1ee)) / 0x4) + - parseInt(_0x1b32e1(0x1f4)) / 0x5 + - parseInt(_0x1b32e1(0x217)) / 0x6 + - -parseInt(_0x1b32e1(0x1f0)) / 0x7 + - -parseInt(_0x1b32e1(0x1ec)) / 0x8 + - (parseInt(_0x1b32e1(0x212)) / 0x9) * (parseInt(_0x1b32e1(0x1ef)) / 0xa); - if (_0x5756ef === _0x261cac) break; - else _0x50c906['push'](_0x50c906['shift']()); - } catch (_0x53682e) { - _0x50c906['push'](_0x50c906['shift']()); - } - } -})(_0x54ef, 0xc5dab); -function _0x15ff(_0x48b7ea, _0x31ada3) { - const _0x54ef59 = _0x54ef(); - return ( - (_0x15ff = function (_0x15ff5c, _0x316213) { - _0x15ff5c = _0x15ff5c - 0x1e7; - let _0x255414 = _0x54ef59[_0x15ff5c]; - return _0x255414; - }), - _0x15ff(_0x48b7ea, _0x31ada3) - ); -} -{ - const STRING_INPUTS = [ - _0x1410a1(0x207), - _0x1410a1(0x1e7), - 'password', - _0x1410a1(0x1f3), - _0x1410a1(0x208), - 'url', - _0x1410a1(0x1fd), - _0x1410a1(0x201), - 'time', - _0x1410a1(0x1f8), - _0x1410a1(0x1eb), - _0x1410a1(0x21b), - _0x1410a1(0x218), - _0x1410a1(0x1f5), - ], - BOOLEAN_INPUTS = [_0x1410a1(0x214)], - NUMBER_INPUTS = [_0x1410a1(0x209), _0x1410a1(0x1e9)], - NO_ARG = Symbol(_0x1410a1(0x21a)), - NO_ID = _0x1410a1(0x20a), - INVALID_ID = 'id\x20is\x20not\x20a\x20string\x20(first\x20argument)', - wrongInputMessage = ({ - type: type = 'strings', - id: id = '', - allowed: allowed = [], - name: name = _0x1410a1(0x216), - }) => - '' + - name['toLowerCase']() + - (id ? '#' + id : '') + - _0x1410a1(0x210) + - type + - '.\x0a' + - (allowed && allowed[_0x1410a1(0x219)] > 0x0 - ? 'try\x20using\x20one\x20of\x20these\x20types\x20instead:\x0a-\x20' + - allowed['join'](_0x1410a1(0x1f6)) - : '') + - '\x0a', - readString = (_0x5e9da5 = NO_ARG) => { - const _0x42d307 = _0x1410a1; - if (_0x5e9da5 === NO_ARG) throw new Error(NO_ID); - if (typeof _0x5e9da5 !== _0x42d307(0x203)) - throw new TypeError(INVALID_ID); - const _0x2b7c51 = document[_0x42d307(0x1f1)](_0x5e9da5); - if (_0x2b7c51 === null) - throw new Error(_0x42d307(0x20c) + _0x5e9da5 + '\x22'); - if (_0x2b7c51[_0x42d307(0x1ff)] !== 'INPUT') - throw new TypeError( - _0x2b7c51[_0x42d307(0x1ff)][_0x42d307(0x1f9)]() + - '#' + - _0x5e9da5 + - _0x42d307(0x1fa), - ); - if (!STRING_INPUTS['includes'](_0x2b7c51[_0x42d307(0x1fb)])) - throw new TypeError( - wrongInputMessage({ - allowed: STRING_INPUTS, - name: _0x2b7c51[_0x42d307(0x1ff)], - id: _0x2b7c51['id'], - }), - ); - return _0x2b7c51[_0x42d307(0x20b)] || ''; - }, - display = (_0x56fa14 = NO_ARG, _0x2b6c48 = NO_ARG) => { - const _0x4048a9 = _0x1410a1; - if (_0x56fa14 === NO_ARG) throw new Error(NO_ID); - if (typeof _0x56fa14 !== 'string') throw new TypeError(INVALID_ID); - if (_0x2b6c48 === NO_ARG) throw new Error(_0x4048a9(0x1f7)); - const _0x622bda = document[_0x4048a9(0x1f1)](_0x56fa14); - if (_0x622bda === null) - throw new Error( - 'there\x20is\x20no\x20element\x20with\x20id\x20\x22' + - _0x56fa14 + - '\x22', - ); - if ( - _0x622bda[_0x4048a9(0x1ff)] === _0x4048a9(0x20f) || - _0x622bda[_0x4048a9(0x1ff)] === _0x4048a9(0x1f2) || - (_0x622bda['nodeName'] === _0x4048a9(0x21c) && - (STRING_INPUTS[_0x4048a9(0x206)](_0x622bda[_0x4048a9(0x1fb)]) || - BOOLEAN_INPUTS['includes'](_0x622bda[_0x4048a9(0x1fb)]) || - NUMBER_INPUTS[_0x4048a9(0x206)](_0x622bda['type']))) - ) - throw new Error( - _0x622bda[_0x4048a9(0x1ff)] + - '#' + - _0x56fa14 + - _0x4048a9(0x213) + - _0x4048a9(0x205) + - _0x4048a9(0x204), - ); - _0x622bda[_0x4048a9(0x202)] = _0x2b6c48; - }, - readSelection = (_0xb29b29 = NO_ARG) => { - const _0x429363 = _0x1410a1; - if (_0xb29b29 === NO_ARG) throw new Error(NO_ID); - if (typeof _0xb29b29 !== _0x429363(0x203)) - throw new TypeError(INVALID_ID); - const _0x79dba = document[_0x429363(0x1f1)](_0xb29b29); - if (_0x79dba === null) - throw new Error(_0x429363(0x20c) + _0xb29b29 + '\x22'); - if (_0x79dba[_0x429363(0x1ff)] === _0x429363(0x20f)) - throw new TypeError(_0x429363(0x20d)); - if (_0x79dba[_0x429363(0x1ff)] !== 'SELECT') - throw new TypeError( - _0x79dba[_0x429363(0x1ff)][_0x429363(0x1f9)]() + - '#' + - _0xb29b29 + - _0x429363(0x1fc), - ); - return _0x79dba[_0x429363(0x20b)] || ''; - }, - reverseWordOrPhrase = () => { - const _0x4618b9 = _0x1410a1; - debugger; - const _0x258902 = readString('user-text'), - _0x26be2e = readSelection(_0x4618b9(0x1e8)); - let _0x20500c = ''; - if (_0x26be2e === 'each') { - const _0xd9ece1 = _0x258902['split']('\x20'), - _0x4bfce6 = []; - for (const _0x2cc015 of _0xd9ece1) { - let _0x31a21a = ''; - for (const _0x34ebfc of _0x2cc015) { - _0x31a21a = _0x34ebfc + _0x31a21a; - } - _0x4bfce6[_0x4618b9(0x20e)](_0x31a21a); - } - _0x20500c = _0x4bfce6[_0x4618b9(0x1ea)]('\x20'); - } else { - let _0x1884d7 = ''; - for (const _0x22d987 of _0x258902) { - _0x1884d7 = _0x22d987 + _0x1884d7; - } - _0x20500c = _0x1884d7; - } - display(_0x4618b9(0x200), _0x20500c); - }; - document[_0x1410a1(0x1f1)]('do-it')[_0x1410a1(0x1ed)]( - 'click', - reverseWordOrPhrase, - ); -} -function _0x54ef() { - const _0x44f6da = [ - 'you\x20did\x20not\x20pass\x20an\x20element\x20id\x20(first\x20argument)', - 'value', - 'there\x20is\x20no\x20element\x20with\x20id\x20\x22', - 'do\x20not\x20read\x20the\x20- if you enter a palindrome, the screen turns green: - -
- -