Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Cannot get Practice 03_12 to work.

Aperta
#8 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
frontend

Direzione di ricerca

Inizia con Practice 03_12 ed esamina index.html, script.js e Backpack.js, concentrandoti su come viene caricato il class module e su come la console del browser accede alle variabili dell’esercizio. Riproduci il problema con atom-live-server in Chrome o Edge, quindi verifica che l’accesso previsto dalla console funzioni senza compromettere la class structure fornita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
JavaScript
Stelle
2k
Fork
4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di LinkedInLearning/javascript-essential-training-2832077

Tutte le issue di LinkedInLearning/javascript-essential-training-2832077

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.