Essay for you

Ascension Press Chosen Lesson 13 Homework

Category: Homework

Description

Oxford University Press - Key New Works

OUP Annual Report 2013/14 Key New Works

Alrededor de la Ciencia (Around Science) (OUP España)

Alrededor de la Ciencia is a pre-primary series for 3—5-year-olds specifically developed to help students to experiment with science and understand their natural environment from a scientific point of view. It aims to teach basic principles in the fields of biology, chemistry, physics, and ecology. The series comprises six booklets: Animales en el Aula (Animals in the Classroom); Todos Somos Seres Vivos (We Are All Living Beings); La Cocina (The Kitchen); El Huerto (The Allotment); Las Tres RRR (Recycling); and El Parque (The Playground).

English File (English Language Teaching)

The best-selling English File teaches English to adults by placing heavy emphasis on fun and enjoyable lessons that get students talking. Texts are chosen with a view to their readability and ability to rouse interest in the reader. Every lesson contains exercises to combat poor pronunciation—identified as a major contributor to breakdowns in communication. The third edition of English File has seen the course’s content and components updated and improved for students and teachers. The digital package includes new English File iTool resources, a pronunciation app for mobiles, an online workbook, and websites for both students and teachers.

Everybody Up (English Language Teaching)

Everybody Up is a seven-level course that motivates children by linking the English classroom to the wider world. It encourages children to use language in a natural and meaningful way by connecting English to their own lives. It includes colourful cross-curricular lessons, fun stories, and songs, whilst the Everybody Up 'Friends' motivate students to practise English at home. The course was launched with the help of an Everybody Up Global Sing-Along—a social media campaign that gave children and teachers around the world the chance to sing the same songs and share their performances.

GCSE Science Online Homework (Oxford Education)

GCSE Science Online Homework is a subscription website that allows teachers to assign homework in a straightforward and time-saving manner. Students can easily access the site from home and all activities are automatically marked to reduce the burden on teachers. The website aims to make homework an interactive experience, allowing students to complete their work multiple times and receive feedback as they go, with engaging activities designed to keep them motivated. This is the first online product the science team has developed and feedback from the market has been extremely positive.

IB Mathematics (Oxford Education)

Produced in response to changes in the International Baccalaureate Mathematics syllabus, IB Mathematics consists of a comprehensive suite of textbooks produced in partnership with the International Baccalaureate Organisation. Expert teachers were involved both as authors and reviewers to ensure that the resources enabled teachers to deliver the new syllabus. The textbooks frame mathematics in a meaningful, global context and come with an e-book, a full set of worked solutions, and extra support and exam-style questions on accompanying CDs.

Kamusi ya Watoto (OUP East Africa)

Kamusi ya Watoto is a monolingual (Swahili-Swahili) dictionary for children aged six to nine years, and all beginners of Kiswahili. The first of its kind in the market, it helps learners not only understand the language, but also equips them with dictionary skills in their formative years. Well received by students and teachers, it comes complete with more than 1,700 headwords, example sentences, and colour illustrations and also contains study pages, activities, and language games.

Let’s Go (English Language Teaching)

English Language Teaching’s flagship American primary course, Let’s Go has taught millions of children around the world to speak English through its trusted methodology. It utilizes songs, chants, and exercises encouraging classroom interaction to keep students engaged and focused on learning. The fourth edition builds on the brand with a fully integrated phonics and reading programme. The Let’s Share social media campaign will build on author Barbara Sakamoto’s award-winning site, Teaching Village, by sharing free ideas, tips, resources, and webinars on topics requested by teachers.

Mortal Choas by Matt Dickinson (Oxford Education)

Bestselling writer and film-maker Matt Dickinson is only the fifth British climber ever to have scaled the north face of Mount Everest. He was therefore well placed to write this high-adrenaline adventure based on ‘the butterfly effect’—the theory that a single occurrence, no matter how small, can change the course of events. This multi-voiced narrative, that cuts between different strands of fast-paced action, was well received by teenage readers, especially boys. During February and March 2012, Matt visited more than 50 schools to talk about his enduring and sometimes dangerous passion for wild places and Mortal Chaos. OUP will be publishing two more Mortal Chaos novels over the next 18 months.

Oxford Digital: Recursos para el Profesor y el Aula (Resources for the Teacher and the Classroom) (OUP España)

A new collection of digital resources for secondary teachers, each DVD in the Recursos para el Profesor y el Aula series includes an enriched PDF students’ book and ready-to-print and multimedia resources necessary for preparing classes and for assessment purposes.

Oxford Online Learning Zone (OUP España)

An access-controlled website for primary school children using Oxford’s English language teaching primary courses, which cover the four core skills of reading, writing, speaking, and listening. The site includes a wide variety of online resources to help children with their English at home and at school, including interactive stories and songs, extra practice activities to accompany their course book, and a ‘Fun Zone’ area. There is also a support page for parents offering practical suggestions of ways in which they can encourage and consolidate their children’s learning.

Designed for the Hong Kong market—where a firm grasp of the English language is essential for future educational and career prospects—Oxford Path is a package of 40 connected stories with supplementary materials such as drama books, phonics activity books, flash cards, DVDs, CDs, and e-learning tools. Based on empirical research, it is the result of three years’ collaboration between OUP China’s editorial team and nine scholars and experts in English language teaching and child development. Parents signing up are expected to be actively involved in their children’s development and are given the opportunity to meet OUP China’s language consultants twice a year to ensure the children’s steady progress. There is also a service centre dedicated to the Oxford Path where parents can take advantage of seminars, workshops, and other educational activities.

Oxford Reading Tree Traditional Tales (Oxford Education)

A collection of 40 enchanting tales from around the world, which can be phonically decoded to enable children to read the stories themselves. Featuring award-winning authors and illustrators, Oxford Reading Tree Traditional Tales includes such traditional favourites as the Little Red Hen, Jack and the Beanstalk, Cinderella, and Mulan. Each tale includes a story map to help children with their own writing and storytelling, whilst there is a wealth of online support for the teacher including teaching notes, a selection of e-books, and professional storyteller videos.

Pathways: An Interactive Course in English (OUP India)

Pathways: An Interactive Course in English provides a comprehensive curriculum for learners of English. It is a three-book package comprising a course book accompanied by an interactive CD, a workbook, and a literature reader. The course hones language skills through tasks that focus on listening for surface comprehension and specific details; speaking fluently and idiomatically; reading for surface and inferential comprehension; and writing accurately in formal and creative contexts. The series also provides teachers with integrated assessment tools to enable them to monitor the progress of their students.

Read Write Inc. Fresh Start—More Anthologies (Oxford Education)

Read Write Inc. Fresh Start offers older primary and lower secondary schoolchildren who have not made progress in their reading a second chance to catch up and become fluent readers. These seven new titles contain a variety of lively non-fiction, poetry, and fiction texts and also include quizzes, play scripts, and comic strips to motivate pupils to read for pleasure. They can be used alongside the Read Write Inc. Fresh Start Modules to help pupils to develop their reading and writing skills, and can also be used to supplement other reading programmes.

Read Write Inc. One-to-One Phonics Tutoring Kit (Oxford Education)

Developed with leading literary expert Ruth Miskin, this new kit contains everything a teacher needs for high-quality, one-to-one tuition for children who require extra help with learning to read. It is designed for use by both teachers and teaching assistants and contains a professional development DVD and handbook featuring advice from Ruth Miskin, four lively progress books which provide lots of practice activities in decoding sounds and words, plus all the essential materials from Read Write Inc. Phonics. The series aims to get all children reading by the age of 6.

School Based Assessment Packs (Oxford Fajar, Malaysia)

Oxford Fajar was the first publisher to produce an innovative and useful product to help teachers to implement a new school-based assessment system. The resource pack consists of sets of worksheets for students and teachers, a question bank, a photo bank with audio component for science, and a teacher’s guide that maps performance standards against the curriculum learning standards. School Based Assessment Packs for Primary 1 were published in 2011/12 and packs for Primary 2 and Form 1 will appear in 2012/13. The new product has been well received by teachers and the Malaysian Examination Board.

Other articles

Lesson 14

Lessons

Details 08 September 2011

In this lesson we will:

- create menu items with IDs
- group and sort menu items

In the previous lesson we observed the simplest way of creating a menu using add(CharSequence title) method, we passed only text as a parameter. Let’s have a look at another implementation of this method - add(int groupId, int itemId, int order, CharSequence title). This methods takes 4 parameters :
groupId - group identifier to which a menu item belongs to
itemId - menu item ID
order - for specifying the order in which menu items will be shown
title - text that will be displayed

We will create an application to illustrate how all these parameters are used. There will be a TextView and a CheckBox on the screen:
- TextView will display which menu item was chosen
- CheckBox will define whether to show a simple or expanded menu. It will be implemented using menu groups.

Let me clarify that terms "simple menu" and "expanded menu" - are not Android terms, these are my namings. So when the application is running and the user clicks menu button, he will see a "simple" menu. If the user checks the CheckBox, the "expanded" menu which contains more items will be displayed.

Let’s create a project:

Project name. P0141_MenuAdv
Build Target. Android 2.3.3
Application name. MenuAdv
Package name. ru.startandroid.develop.menuadv
Create Activity. MainActivity

Open main.xml. assign the ID to an existing TextView. erase text in it and create a CheckBox. Code:

Open MainActivity.java and fill in MainActivity class with the following code:

Don’t forget to update imports (CTRL + SHIFT +O).

Let’s look through the code above. We use the following methods :

onCreateOptionsMenu - is invoked only when the menu is shown for the first time. Creates a menu and is not used any more. We add menu items here.

onPrepareOptionsMenu - invoked every time before displaying the menu. We make changes to the already existing menu if it is necessary.

onOptionsItemSelected - is invoked when the menu item is clicked. Here we define which menu item has been clicked.

In the onCreateOptionsMenu we add 6 menu items. Have a look at the add method parameters.

The first parameter is the group ID. For the first three items it equals 0, for the other three it equals 1. So the copy. paste and exit menu items are united into a group with ID = 1. Visually, it is not displayed in any way - they do not differ in color or something else. We will use group ID in onPrepareOptionsMenu implementation.

The second parameter is ID of menu item. It is used in listener to define which menu item has been pressed. We will use it in onOptionsItemSelected .

The third parameter defines the item position in the menu. This parameter is used for defining the order of menu items when it is displayed. The sort order is ascending. from smaller order to larger.

The fourth parameter is text. which will be displayed on the menu item. Everything is clear with it.

Menu object is passed to onPrepareOptionsMenu method and we can work with it. In the current example we invoke setGroupVisible. This method allows to hide\show menu items. It is passed two parameters - group ID and a boolean value. We write 1 for the group ID (the same group which contains copy, paste and exit menu items). We will use the CheckBox state as a boolean parameter. If it is checked, menu items (from the group where ID = 1 ) will be displayed, if not - items will not be displayed.

Let’s save everything and launch the application.

Depending on CheckBox state, 3 or 6 items in menu are visible.

Pay attention to the item order. They are sorted by order parameter ascending. If the order of several items is the same. these items will be positioned in the order of their creation in onCreateOptionsMenu method.

When pressing any menu item, onOptionsItemSelected method is triggered. In this method we output the information about the item pressed to the TextView. You can compare this information to those we have coded when creating menu items. All the parameters have to match. I’ve made the same order of items as in the add method for convenience: groupId. itemId. order. title .

Try to add some more items to the menu and have a look how they are displayed.

To simplify the code I’ve hardcoded numbers for group IDs and menu item IDs. Usually, it is recommended to use constants. I will use constants further.

XML-menu

There is one more convenient and preferable way of creating a menu - using an xml-file, the same as layout-file when creating a screen. To get a menu which we have created programmatically in this lesson, we will create mymenu.xml file in res/menu folder:

item - is a menu item, group - group of items. In the ID attributes we use the same approach as with IDs of screen components - @+id/<your_ID> and Eclipse will generate these IDs in R.java. orderInCategory attribute is the order of items, title is a text of menu item.

Now we don’t need to hardcode the creation of each menu item, we will just connect menu, which is passed as a parameter to the onCreateOptionsMenu method and our xml-file:

Using getMenuInflater method we obtain MenuInflater and invoke its inflate method. We pass our mymenu.xml file from res/menu folder and menu object as parameters. MenuInflater takes a menu object and fills it with menu items from mymenu.xml file.

if you want to hide a group, invoke the same setGroupVisible method and pass R.id.group1 as a parameter for group ID.

You can view attributes for menu xml-file in more details here .

I recommend you to try and test both ways of creating a menu. Creating menu programmatically is more flexible, but xml shrinks the code amount.

On the next lesson we will:

- create a context menu

Language

Jesus Ascension Sunday School Lesson for Children

Lesson: Apostles Witness Jesus’ Ascension (Acts 1:1-11)

This kids Bible lesson is based on the story from Acts 1 where the Apostles see Jesus ascend to Heaven. This lesson plan was first taught in children’s Sunday School but could be modified for children’s church. Be sure to note the links at the end of this lesson for even more learning activities that go along with this passage.

Bible Story: Apostles witness Jesus’ Ascension
Scripture: Acts 1
Target Age Group: Age 9 – 11 (U.S. 3rd – 5th Grade)
Learning Context: 4th Grade Sunday School
Printer Friendly Bible Lesson: PRINT this lesson plan
You Can Help. Please leave your feedback and suggestions for this lesson plan. Others will benefit from your ideas. Click here to respond

Supply List: Butcher Paper, pencils, crayons or markers.

Learning Goal: The aim of this lesson is to help students to understand that believers are never alone because the Holy Spirit lives inside their heart.

Learning Indicators: Students will discover truth about Jesus’ resurrected appearances by reading Scripture verses together. The review questions allows the students to demonstrate their knowledge of the key events and people in the lesson.

As students arrive have butcher paper taped to a table and provide Scripture references to Jesus’ Resurrection Appearances for the students to choose. They can draw on the paper a picture representing the passage. The students can title the mural “Convincing Proofs”. This activity prepares them for discussion in the Bible Lesson. (Scriptures: Matthew 28:10; John 20:11-18; Luke 24:13-15; Luke 24:33-34; Luke 24:36-43; John 20:24-29; John 21:1-14; Mark 16:14; 1 Corinthians 15:6; 1 Corinthians 15:7 )

Test: Students will be able to answer the review questions.

Bible Lesson: Apostles witness Jesus’ Ascension

The following is a guide to teach Acts 1. Provide Bibles for students who did not bring one.

(Pray for sensitivity to the needs of your students as you discuss abandonment. There may be students in class who have truly experienced abandonment from one or both parents. This lesson emphasizes that God never abandons His children.)

Let’s turn in our Bibles to Acts 1. Review with the class what they remember from last week’s overview of Acts 1-9.

Before we get into Acts chapter one, I would like for you to think about if there has been a time when you felt abandoned and all alone? Maybe you have been in a store with your family and you were distracted by something you were looking at and when you looked around your family was gone. At that moment how did you feel? When a person is left all alone he/she may feel abandoned or deserted. For the few minutes you were deserted by your family members you may have felt very frightened. As soon as you were reunited with your family you were so relieved and comforted to not have been truly abandoned.

Jesus’ disciples spent three years following Him. They heard Him teach about God’s Kingdom and witnessed Him perform many miracles. When they saw the Son of God nailed to a cross and die they may have experienced feelings of abandonment. They believed Jesus was God’s Promised Messiah and now He was dead and His body had been placed in a sealed tomb.

Feelings are not always the truth of what is really happening in a situation. If the disciples had felt abandoned when Jesus died it was not the truth. Jesus told them very clearly before He was nailed to the cross that He was going to suffer and would rise again. Matthew 26:32 “But after I have risen, I will go ahead of you into Galilee.” (Matthew 16:21 , Matthew 17:12. Mark 8:31. Luke 9:22 )

Even though the disciples had been told by Jesus what to expect they were most likely frightened and overwhelmed when the things that Jesus said would happen were taking place. It would not have been easy to watch the innocent Son of God be treated like a criminal and be nailed to a Roman Cross. It was very traumatic and unsettling for Jesus’ disciples.

Sometimes feelings of fear, sadness, or loneliness can cloud our hearts to the truth that Jesus has spoken to us from His Word. The Bible is full of God’s instructions for His people to follow until He returns or calls them home. When we have feelings that seem to overwhelm us we need to find out the truth from reading God’s Word.

Three days after Jesus was buried in a sealed tomb God raised Him from the dead! He did exactly what He told the disciples He would do.

To prove that Jesus was really alive and not a figment of the disciples’ imaginations, Jesus stayed on the earth for 40 days after His resurrection. Let’s look at Acts 1:3. Luke tells us that over those 40 days Jesus gave many convincing proof of His resurrection.

This morning as you arrived our activity was to make a mural that records the different times that Jesus appeared to people in His resurrected body. (Allow students to share the different times that Scripture tells of Jesus appearing to someone or a group of people after He rose from the dead.)

It must have been so comforting to the once very frightened and discouraged apostles to have Jesus with them again.

Luke tells us what Jesus did during the period of forty days. Let’s look at the last part of verse 3 and see what He did with the apostles. (He spoke about the Kingdom of God.)

Jesus gave His apostles a very important instruction. Read Acts 1:4-5. Jesus knew what God’s plans were and He was preparing them for when He returned to heaven. The apostles didn’t fully understand what was about to happen. Even though they didn’t understand they needed to follow the instructions Jesus gave them.

God’s plan was for Jesus to return to heaven. Jesus had chosen His apostles to be messengers for Him after He left. What message did Jesus want His apostles to tell others? Matthew 28:19-20 .

Although Jesus was returning to heaven He was not abandoning His apostles. God never leaves or abandons His children.

Let’s look at Acts 1:8. If you were here last week this was our memory verse. This verse helps the Apostles to know that they would not be abandoned and left alone. Jesus told them that God was going to send the Holy Spirit to give them His power to take the message to all people.

This message could not be taken to the people without God’s power. It was important for the Apostles to obey Jesus’ instructions and wait in Jerusalem for the Holy Spirit.

When Jesus finished instructing the apostles, His feet lifted off the ground and He began to ascend or go up into the sky. As He went up into the sky a cloud hid Him from the apostles’ sight.

Let’s imagine being there on that day. Do you think the apostles strained to see Jesus and try to get just one last glimpse of Him?

Let’s read Acts 1:10-11. Who do you think these two men were? (Angels)

As we read this passage we can see God’s faithfulness to send these two men to give this message. I wonder how long they would have stood there staring up into the sky if they had not received this message from the 2 men.

The apostles had a job to do for the Lord Jesus. They had work to do but first they needed to follow Jesus’ instructions. He told them to stay in Jerusalem and wait for the Holy Spirit.

They obeyed His instructions and went to Jerusalem. They went into a room where they were staying. Let’s find out who was in this upper room. Read Acts 1:13-14 .

While they were waiting for the Holy Spirit what does verse 14 tell us these people did? (They joined together constantly in prayer.)

Instead of allowing the fear of abandonment overwhelm them Jesus’ followers spent time praying and waiting for Jesus to send His Holy Spirit. Peter also spoke to the group that was gathered. Let’s read Acts 1:15 and find out how many were gathered together when Peter spoke. Peter told the believers that when Judas betrayed Jesus, he did exactly what God’s Word said he would. Peter said that they needed to select another apostle to replace Judas. Peter told them what the requirements for an apostle needed to be. Look in Acts 1:21-22 to find out what they were. (Someone who had been with them the whole time Jesus ministered on the earth until the time He ascended. He needed to be someone who witnessed Jesus’ resurrection.)

Two men selected based on the requirements were Justus and Matthias. The apostles prayed and asked God which one He had chosen to replace Judas. The man chosen to replace Judas was Matthias.

It would have been easy for the apostles to sit around feeling sad that Jesus had returned to heaven. Instead they chose to obey Jesus’ instructions and wait in Jerusalem for the Holy Spirit. They didn’t just waste time as they waited, they spent their time praying and waiting.

The apostles would miss having Jesus walk with them and being able to see His face. Very soon God would be sending the Holy Spirit to them. The Holy Spirit will always be with them and go wherever they go. The Holy Spirit would give them power to do the important job of sharing the Good News with other people.

After reading about the early days before Jesus returned to heaven we can be encouraged that Jesus has not left us alone. He has not abandoned us. If we believe that He died on the cross for our sins and was raised to life on the third day, the moment we believed His Holy Spirit came to live inside our hearts. We will never be alone and wherever we go, Jesus goes with us. If we ever feel sad, alone or confused we have the entire Book of the Bible to instruct us how to live our lives while we wait for Jesus to return or until He takes us to be with Him in heaven.

Next week our lesson will be about when God sends His Holy Spirit on the day of Pentecost. We hope you will not miss it!

Close in prayer.

  1. How many days did Jesus stay on the earth after His resurrection? (40)
  2. Who are some people that Jesus appeared to in His resurrected body?
  3. What instructions did Jesus give His disciples before He returned to heaven?
  4. Why did Jesus say they needed to wait for the Holy Spirit? (Acts 1:8)
  5. Why were the apostles staring up at the sky?
  6. How did the 2 men say Jesus would return?
  7. Where did the apostles go after Jesus ascended?
  8. Name some of the people who were gathered in the upper room.
  9. What did the apostles do after Jesus returned to heaven?
  10. Who was chosen to replace Judas as an apostle?
Additional Sunday School Resources:

Need More Ideas for Sunday School? Then browse our list of kids Bible crafts or find a Bible Coloring page to accompany this lesson.

English for beginners, Lesson 13

English for beginners, Lesson 13. Homework

1) Insert the following adjectives: expensive, important, interesting, incredible, dear, amusing, adorable, next, last, lovely, nice, well-known, noble, obvious.

  • I want to buy this painting; it is so ______! But I can’t afford it. It is too ___.
  • What a ______ boy!
  • His answer is _______, and his reaction is _______.
  • My _____ child, I want to tell you a very ______ piece of news!
  • Who is ____?
  • Oh, that’s _______! I can’t believe it!
  • The _____ time I saw her, she wanted to make a haircut. Maybe now it would be difficult to recognize her.
  • That’s an _____ game, but they don’t want to play it.
  • We have a horse-breeding business. Look at this ____ horse!
  • It is _________ that the Earth rotates around the Sun.
  • Thank you! It was a _____ dinner.

2) Correct the mistakes (chose the correct place for the adjective:

  • What remarkable a picture!
  • This is nice very of you.
  • You are more than beautiful I thought.
  • He angry is always.
  • That tender sounds.
  • What a play perfect. I love it.
  • I want to take part in international an chess tournament.
  • Bob handsome is, unfortunately, shy he looks too.
  • Why does she have such a smile sly ?
  • Andrew Perkins is the most writer famous of the year.
  • This is imaginary an fact.
  • His glory would immortal be.
  • Can you believe it? We met a hero living !

3) Make the comparative form:

  • You are beautiful, but your sister is _____ ______.
  • He’s so angry. I haven’t seen him ____ before.
  • It’s dangerous. I don’t know anything ______ ______.
  • This cake is big enough, but the previous one was ____.
  • Don’t you think this exercise is easy? No, the previous one was ____.
  • Today my skirt is not short. Yesterday it was _____.
  • Don’t you think that this is funny? Please, try to make something ____.
  • He is old, but he can’t sit still. I am afraid that when he gets ____, he will become a true adventurer!
  • Andy is happy today. Have you seen him ____ before?
  • You are famous, why do you want to be ___ ___?
  • That day was so sunny! How do you think will this day be ____?

4) Make the superlative form:

  • Are you hungry? – Yes, I am __ ____ person here!
  • Do you think this dish is tasty? It should be __ ___ dish for the festival.
  • They are important for me, but nothing more. Why do you think they are __ __ __ people for me?
  • Sunday I always feel happy. But this Monday I will be __ ___ person in the world: I will meet my best friend!
  • Are you healthy? – Yes, thank you. I’m __ ___ man.
  • Is he young? Yes, he is __ ___ among us.
  • I have visited a lot of markets in my life; all of them were crowded. But this one is __ ___ ____.

Find out the grammar for this lesson here .

Lesson 13: JavaScript Objects: Arraysentutorial

Lesson 13: JavaScript Objects - Arrays

Just using a few properties and methods of common JavaScript objects has opened your eyes to the amazing things that Object Oriented Programming enables you to accomplish with a few lines of code. In this lesson, you will learn to use what is a very powerful object in most programming languages, including JavaScript of course: the Array object .

In particular, in this lesson you will learn:

  • what the Array object is for ;
  • how to create arrays ;
  • how to access, sort, add, and remove data inside an array .

In the process, you will learn how to use the for. in loop to access data inside an array.

What is the Array object for?

An object's job is that of storing and allowing for the easy manipulation of data. We can safely say that the Array object performs both tasks wonderfully.

From the perspective of data storage, an array works a bit like a variable. The difference is that you are not limited to one piece of data, as it's the case with common variables. You can stuff several items at once inside an array and retrieve whichever you need at the right time in your program.

Imagine if you had to have a storage place for each pair of socks. This would be a nightmare! Having a drawer to store all your socks in one place makes much more sense. In this respect, arrays are a bit like drawers, but much more powerful.

From the point of view of data manipulation, the Array object offers a wealth of properties and methods, some of which you will examine in this lesson.

How do you create an Array object?

You create an array in 1 of 3 ways:

1) use new Array()

This is the most verbose approach. It works as follows:

2) use new Array(item0, item1, item2. )

This approach also employs the new Array() constructor, but does so using a more concise formulation. Here's what it looks like:

3) use the literal array approach

This is the shortest way of creating and populating an array, and it's the most widely used approach. It looks like this:

All 3 approaches illustrated above, create an array object called colors containing 2 string values, "green" and "red" - but arrays can store all other data types: numbers, booleans, even other arrays! The items in our array occupy position 0 and 1 respectively.

As you might have guessed, you count the index position of an item inside an array starting at 0 .

But, is this index position important? Well, yes it is, at least if you want to use the items inside the array, which is most likely the case.

Here's what I mean.

How do I access data inside the Array object?

Arrays are great to store several values using only 1 variable. However, they wouldn't be so great if you couldn't also access those values quickly and easily. Here's how it's done:

Enter the code snippet above between enclosing <script> tags in an HTML page, save your work, and run the page in the browser. You should see the word red displayed on the page.

What you did was to access the second value in the colors array by using its index position within the array starting to count at 0.

Access all items in the array with a loop

You might have probably guessed this, but loops and arrays go together like cookies and milk. Here's how you would access all values inside an array by looping over each of them:

Save your file and preview the page in a browser. You should see the color names displayed on the page.

There's also a special type of for loop that you can use with the Array object, the for. in loop. Here's how it works:

Run the HTML document containing the code snippet above inside <script> tags in a browser. The web page should look the same as it did in the previous example.

Once you access a value inside an array you can simply retrieve it, as you did in the previous example, or you can modify it, as follows:

Can I sort array items?

You can do amazing stuff with values stored inside an array. For example, you can sort items alphabetically, in descending or ascending order, or numerically. Let's see how this is done.

You sort array elements with a fantastic method most appropriately called sort(). Here it is in action:

If you want to sort numerical values inside an array, either in ascending or descending order. you need to build a simple custom function and pass this function as argument to the sort() method. It sounds a bit harder than it actually is. Here's how it's done:

How do I add data to the Array object?

You can add new items inside an array in different ways. Which method you choose depends largely on your program's requirements.

Add items to the end of the array with push()

What feels more like the natural order of things, that is, adding an item to the end of an array, is easily achieved using the push() method. Here's how it works:

Add items to the beginning of an array with unshift()

Use unshift() to add new items to the start index position of an array. This is easily done.

Just replace push() with unshift() in the previous example, save your work and run the page in a browser. The page should display the color name "pink" at the very start, like so:

How do I remove data from the Array object?

If you want to remove the last item in an array you use pop(). If you want to remove the first item in an array you use shift() .

Have fun experimenting with the examples above and come back to our try out challenge as soon as you're ready.

Try out: Username registration

You will build a mock Username registration program with the following requirements:

  • the user can enter a Username in the inputbox. and click a button to register;
  • if the Username already exists, the program informs the user;
  • if the Username is not already stored in the program, the new Username is added, the user is informed, and all stored Usernames are displayed on the page in alphabetical order.

A real registration program would ask for more information, the data would be permanently stored in a database, and existing Usernames would never be printed out for everybody to see.

However, this is a mock application: our Usernames are stored in a global array. This ensures that the values inside will be accessible from any function in the script, and the newly added Usernames will be preserved for as long as the program runs. Displaying the Usernames on the page will show the workings of the global variable (see Lesson 4 for a refresher on global variables) as well as of the array methods push() and sort() .

Enough talking, let's get coding! Prepare an HTML page with an inputbox, a button, and a paragraph to display messages to the user. Make sure each element has an id value so that your code can have an easy handle on them.

The HTML document The JavaScript file: lesson13_tryout.js

Your program contains:

  • a global array called userNames used to store Usernames;
  • a function called init() used to bind the main function to the onclick event of the button ;
  • and a function called registerName() that performs all the main program tasks.

Save all your files and run the HTML document in a browser. You should see something similar to the example page indicated by following the link above.

Try clicking the button without entering anything in the inputbox, then enter a Username already present in the array - for example, supercoder - and try to register; finally, enter a new name and see it getting added to the array. As you enter new names, these get added to the array and displayed alphabetically.

Summary

You've worked really hard in this lesson, well done! You're now familiar with the Array. a powerful JavaScript object, and some of its fantastic methods. You can also use a for in loop to access array values, and you've built a challenging little demo application.

Take your well-deserved break, the next topic awaits you: get ready for an exploration of the very environment that makes JavaScript possible, the browser .

Tutorials Who is online: Statistics: Language: