Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Cannot get Practice 03_12 to work.

オープン
#8 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
frontend

調査の方向性

Practice 03_12 から始め、index.html、script.js、Backpack.js を調べます。class module がどのように読み込まれるか、またブラウザーコンソールから演習の変数にどのようにアクセスするかに注目してください。Chrome または Edge で atom-live-server を使って問題を再現し、その後、提供されている class structure を壊さずに意図したコンソールアクセスが機能することを確認してください。

索引モデルが issue の本文から書いたものです。

説明

Issue Overview

Scope issue with classes.

Describe your environment

Windows 10 19041, Chrome 88 or Edge, atom 1.55.0, atom-live-server

Steps to Reproduce

Working directly in the file structure provided, I add the following to the empty script.js.

import Backpack from "./Backpack.js";

const mybackpack = new Backpack(
  'test',
  10,
  'red',
  10,
  26,
  26,
  false);

console.log('Values of mybackpack', mybackpack)

In the browser console it prints the mybackpack as I expect. But if I then try to access mybackpack.name or anything of mybackpack it returns the following error:

Uncaught ReferenceError: mybackpack is not defined
at <anonymous>:1:1

Expected Behavior

Being able to access mybackpack from the console as in previous chapters.

Current Behavior

mybackpack is not part of the scope.

Possible Solution

Copying the class definition of Backpack into script.js and and removing pointers to Backpack.js (in index.html as well as in script.js) helps.

To be honest, I think the presence of Backpack.js is just confusing for this exercise and not needed to work through the given tasks.

Screenshots / Video

Related Issues

主要言語
JavaScript
スター
2k
フォーク
4k
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

LinkedInLearning/javascript-essential-training-2832077 のほかの issue

LinkedInLearning/javascript-essential-training-2832077 の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。