If you're seeing this message, it means we're having trouble loading external resources on our website.

Jeżeli jesteś za filtrem sieci web, prosimy, upewnij się, że domeny *.kastatic.org i *.kasandbox.org są odblokowane.

Główna zawartość

Teaching guide: Intro to JS - Arrays

This is a teaching guide for the Intro to JS course, for the 14th unit on Arrays.

Czego uczniowie się nauczą

  • How to create arrays to store a sequence of values in one variable.
  • How to access or change elements of an array using “bracket notation”.
  • How to add elements to an array using the push() method.
  • How to iterate through an array using a for loop.

Uczniowie nauczą się pisać kod taki jak:

Z czym uczniowie mają kłopoty

  • Students take time to get used to the fact that arrays start at index 0, since we’re used to counting from 1 in our every day life. Keep reminding them about that.
  • If students didn’t get comfortable using for loops in the last tutorial, they will likely struggle to use them in this tutorial. If that’s the case, they may want to re-watch the for loop tutorial and go through the challenge again.
  • When iterating with a for loop, students often forget to use bracket notation to access the elements of their array, and they instead access the whole array. Ask them whether their code is truly accessing only one element of the array.
  • Students may wonder if there is a method for removing elements from an array. They can use the pop() method for that. There are in fact many array methods we don’t teach in the intro course, which students can find by searching the web for “JS array methods”.
  • Students may wonder if they can create a 2-d array, to store a grid of values. They can certainly do that, but we don't teach that in the intro course. Search for “multi-dimensional JS array” or “2-d JS array” for examples.

Dodatkowe materiały: pytania do dyskusji

Są to pytania, które możesz zadać uczniom indywidualnie, gdy ukończą ten samouczek lub poprowadź dyskusję grupową, jeżeli każdy ukończył samouczek do tego samego momentu.
  • What data would be useful to store in an array? Open a popular game or an app for inspiration, and have the students brainstorm.

Dodatkowe materiały: pytania i ciekawostki

Te pytania mogą być ciekawym zajęciem po tym, jak każdy uczeń ukończył samouczek. Mogą także prowadzić dyskusję na temat pytań, które sprawiły im trudność. Zagraj z nimi na Quizizz.

Chcesz dołączyć do dyskusji?

Na razie brak głosów w dyskusji
Rozumiesz angielski? Kliknij tutaj, aby zobaczyć więcej dyskusji na angielskiej wersji strony Khan Academy.