100% found this document useful (1 vote)
108 views

Instant Download Get Programming with JavaScript Next New features of ECMAScript 2015 2016 and beyond 1st Edition Jd Isaacks PDF All Chapters

New

Uploaded by

lauffdoubtwv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
108 views

Instant Download Get Programming with JavaScript Next New features of ECMAScript 2015 2016 and beyond 1st Edition Jd Isaacks PDF All Chapters

New

Uploaded by

lauffdoubtwv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Download the Full Version of textbook for Fast Typing at textbookfull.

com

Get Programming with JavaScript Next New features


of ECMAScript 2015 2016 and beyond 1st Edition Jd
Isaacks

https://textbookfull.com/product/get-programming-with-
javascript-next-new-features-of-ecmascript-2015-2016-and-
beyond-1st-edition-jd-isaacks/

OR CLICK BUTTON

DOWNLOAD NOW

Download More textbook Instantly Today - Get Yours Now at textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Beginning Functional JavaScript. Functional Programming


with JavaScript using EcmaScript 6 1st Edition Anto
Aravinth
https://textbookfull.com/product/beginning-functional-javascript-
functional-programming-with-javascript-using-ecmascript-6-1st-edition-
anto-aravinth/
textboxfull.com

Beginning Functional JavaScript: Functional Programming


with JavaScript Using EcmaScript 6 1st Edition Anto
Aravinth
https://textbookfull.com/product/beginning-functional-javascript-
functional-programming-with-javascript-using-ecmascript-6-1st-edition-
anto-aravinth-2/
textboxfull.com

Get Programming with JavaScript First Edition John R


Larsen

https://textbookfull.com/product/get-programming-with-javascript-
first-edition-john-r-larsen/

textboxfull.com

Beginning Functional JavaScript: Uncover the Concepts of


Functional Programming with EcmaScript 8 2nd Edition
Srikanth Machiraju
https://textbookfull.com/product/beginning-functional-javascript-
uncover-the-concepts-of-functional-programming-with-ecmascript-8-2nd-
edition-srikanth-machiraju/
textboxfull.com
Simplifying JavaScript Writing Modern JavaScript with ES5
ES6 and Beyond 1st Edition Joe Morgan

https://textbookfull.com/product/simplifying-javascript-writing-
modern-javascript-with-es5-es6-and-beyond-1st-edition-joe-morgan/

textboxfull.com

Reactive Programming with JavaScript 1st Edition Hayward


Jonathan

https://textbookfull.com/product/reactive-programming-with-
javascript-1st-edition-hayward-jonathan/

textboxfull.com

Get Programming with Scala MEAP V05 Daniela Sfregola

https://textbookfull.com/product/get-programming-with-scala-
meap-v05-daniela-sfregola/

textboxfull.com

Get Programming with Scala MEAP V05 Daniela Sfregola

https://textbookfull.com/product/get-programming-with-scala-
meap-v05-daniela-sfregola-2/

textboxfull.com

Understanding ECMAScript 6 The definitive guide for


Javascript developers 1st Edition Nicholas C. Zakas

https://textbookfull.com/product/understanding-ecmascript-6-the-
definitive-guide-for-javascript-developers-1st-edition-nicholas-c-
zakas/
textboxfull.com
Get Programming with
JavaScript Next: New
features of ECMAScript
2015, 2016, and beyond
JD Isaacks
Copyright

For online information and ordering of this and other Manning


books, please visit www.manning.com. The publisher offers
discounts on this book when ordered in quantity. For more
information, please contact

Special Sales Department


Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964
Email: orders@manning.com

©2018 by Manning Publications Co. All rights reserved.

No part of this publication may be reproduced, stored in a


retrieval system, or transmitted, in any form or by means
electronic, mechanical, photocopying, or otherwise, without
prior written permission of the publisher.

Many of the designations used by manufacturers and sellers to


distinguish their products are claimed as trademarks. Where
those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations
have been printed in initial caps or all caps.
Recognizing the importance of preserving what has been
written, it is Manning’s policy to have the books we publish
printed on acid-free paper, and we exert our best efforts to that
end. Recognizing also our responsibility to conserve the
resources of our planet, Manning books are printed on paper
that is at least 15 percent recycled and processed without the
use of elemental chlorine.

Manning Publications Co.


20 Baldwin Road
PO Box 761
Shelter Island, NY 11964

Development editors: Candace West, Dan Maharry


Tecchnical development editor: Nick Watts
Review editor: Aleksandar Dragosavljević
Project editor: David Novak
Copy editor: Benjamin Berg
Proofreader: Melody Dolab
Technical proofreader: Jon Borgman
Typesetter: Dottie Marsico
Cover designer: Monica Kamsvaag

ISBN 9781617294204

Printed in the United States of America

1 2 3 4 5 6 7 8 9 10 – EBM – 23 22 21 20 19 18
DEDICATION

For my brother, Jon Potts


Brief Table of Contents
Copyright
Brief Table of Contents
Table of Contents
Preface
Acknowledgments
About this book
About the author

Lesson 1. ECMAScript specification and the proposal process


Lesson 2. Transpiling with Babel
Lesson 3. Bundling modules with Browserify
Unit 1. Variables and strings

Lesson 4. Declaring variables with let


Lesson 5. Declaring constants with const
Lesson 6. New string methods
Lesson 7. Template literals
Lesson 8. Capstone: Building a domain-specific language

Unit 2. Objects and arrays

Lesson 9. New array methods


Lesson 10. Object.assign
Lesson 11. Destructuring
Lesson 12. New object literal syntax
Lesson 13. Symbol—a new primitive
Lesson 14. Capstone: Simulating a lock and key

Unit 3. Functions

Lesson 15. Default parameters and rest


Lesson 16. Destructuring parameters
Lesson 17. Arrow functions
Lesson 18. Generator functions
Lesson 19. Capstone: The prisoner’s dilemma

Unit 4. Modules

Lesson 20. Creating modules


Lesson 21. Using modules
Lesson 22. Capstone: Hangman game

Unit 5. Iterables

Lesson 23. Iterables


Lesson 24. Sets
Lesson 25. Maps
Lesson 26. Capstone: Blackjack

Unit 6. Classes

Lesson 27. Classes


Lesson 28. Extending classes
Lesson 29. Capstone: Comets

Unit 7. Working asynchronously

Lesson 30. Promises


Lesson 31. Advanced promises
Lesson 32. Async functions
Lesson 33. Observables
Lesson 34. Capstone: Canvas image gallery

Exercise answers
Here’s a preview of some of the new syntaxes you’ll learn in unit
2
Here’s a preview of using promises and async functions from
unit 7

Index

List of Figures

List of Tables

List of Listings
Table of Contents
Copyright
Brief Table of Contents
Table of Contents
Preface
Acknowledgments
About this book
About the author

Lesson 1. ECMAScript specification and the proposal process

1.1. A brief history of ECMAScript


1.2. Why ES2015 adds so much
1.3. Who decides what gets added?

1.3.1. Specification stages


1.3.2. Picking a stage

1.4. What this book will cover


Summary

Lesson 2. Transpiling with Babel

2.1. What is transpiling?

2.1.1. Compiling to JavaScript languages


2.1.2. Where Babel fits in
2.2. Setting up Babel 6
2.3. The Babel configuration needed for this book

2.3.1. A note on source maps


2.3.2. Set up Babel as NPM script

Summary

Lesson 3. Bundling modules with Browserify

3.1. What’s a module?


3.2. How modules work in Node.js
3.3. What is Browserify?
3.4. How does Browserify help with ES6 modules?
3.5. Setting up Browserify with Babel

3.5.1. Installing Browserify


3.5.2. Setting up a project using babelify

3.6. Alternatives to Browserify


Summary

Unit 1. Variables and strings

Lesson 4. Declaring variables with let

4.1. How scope works with let

4.1.1. Why the block scope of let is preferred

4.2. How hoisting works with let


4.3. Should I use let instead of var from now on?
Summary

Lesson 5. Declaring constants with const

5.1. How constants work


5.2. When to use constants
Summary

Lesson 6. New string methods

6.1. Searching strings


6.2. Padding strings
Summary

Lesson 7. Template literals

7.1. What are template literals?

7.1.1. String interpolation with template literals


7.1.2. Multiline strings with template literals

7.2. Template literals are not reusable templates


7.3. Custom processing with tagged template literals
Summary

Lesson 8. Capstone: Building a domain-specific language

8.1. Creating some helper functions


8.2. Create an HTML-escaping DSL
8.3. Create a DSL for converting arrays into HTML
Summary

Unit 2. Objects and arrays

Lesson 9. New array methods

9.1. Constructing arrays with Array.from


9.2. Constructing arrays with Array.of
9.3. Constructing Arrays with Array.prototype.fill
9.4. Searching in arrays with Array.prototype.includes
9.5. Searching in arrays with Array.prototype.find
Summary

Lesson 10. Object.assign

10.1. Setting default values with Object.assign


10.2. Extending objects with Object.assign
10.3. Preventing mutations when using Object.assign
10.4. How Object.assign assigns values
Summary

Lesson 11. Destructuring

11.1. Destructuring objects


11.2. Destructuring arrays
11.3. Combining array and object destructuring
11.4. What types can be destructured
Summary

Lesson 12. New object literal syntax

12.1. Shorthand property names


12.2. Shorthand method names
12.3. Computed property names
Summary

Lesson 13. Symbol—a new primitive

13.1. Using symbols as constants


13.2. Using symbols as object keys
13.3. Creating behavior hooks with global symbols
13.4. Modifying object behavior with well-known
symbols
13.5. Symbol gotchas
Summary

Lesson 14. Capstone: Simulating a lock and key

14.1. Creating the lock and key system


14.2. Creating a Choose the Door game
Summary

Unit 3. Functions

Lesson 15. Default parameters and rest

15.1. Default parameters


15.2. Using default params to skip recalculating values
15.3. Gathering parameters with the rest operator
15.4. Using rest to pass arguments between functions
Summary

Lesson 16. Destructuring parameters

16.1. Destructuring array parameters


16.2. Destructuring object parameters
16.3. Simulating named parameters
16.4. Creating aliased parameters
Summary

Lesson 17. Arrow functions

17.1. Succinct code with arrow functions


17.2. Maintaining context with arrow functions
17.3. Arrow function gotchas
Summary

Lesson 18. Generator functions

18.1. Defining generator functions


18.2. Using generator functions
18.3. Creating infinite lists with generator functions
Summary

Lesson 19. Capstone: The prisoner’s dilemma


19.1. Generating prisoners
19.2. Getting prisoners to interact
19.3. Getting and storing the results
19.4. Putting the simulation together
19.5. Which prisoner does best?
Summary

Unit 4. Modules

Lesson 20. Creating modules

20.1. Module rules


20.2. Creating modules
20.3. When does a JavaScript file become a module?
Summary

Lesson 21. Using modules

21.1. Specifying a module’s location


21.2. Importing values from modules
21.3. How imported values are bound
21.4. Importing side effects
21.5. Breaking apart and organizing modules
Summary

Lesson 22. Capstone: Hangman game

22.1. Planning
22.2. The words module
22.3. The status module
22.4. The game’s interface modules
22.5. The index
Summary

Unit 5. Iterables

Lesson 23. Iterables

23.1. Iterables—what are they?


23.2. The for..of statement
23.3. Spread

23.3.1. Using spread as an immutable push

23.4. Iterators—looking under the hood of iterables


Summary

Lesson 24. Sets

24.1. Creating sets


24.2. Using sets
24.3. What about the WeakSet?
Summary

Lesson 25. Maps

25.1. Creating maps


25.2. Using maps
25.3. When to use maps
25.4. What about the WeakMap?
Summary

Lesson 26. Capstone: Blackjack

26.1. The cards and the deck


26.2. Making the CPU’s turn slow enough to see
26.3. Putting the pieces together
Summary

Unit 6. Classes

Lesson 27. Classes

27.1. Class declarations


27.2. Instantiating classes
27.3. Exporting classes
27.4. Class methods are not bound
27.5. Setting instance properties in class definitions
27.6. Static properties
Summary

Lesson 28. Extending classes

28.1. Extends
28.2. Super
28.3. A common gotcha when extending classes
Summary

Lesson 29. Capstone: Comets

29.1. Creating a controllable sprite


29.2. Adding comets
29.3. Shooting rockets
29.4. When things collide
29.5. Adding explosions
Summary

Unit 7. Working asynchronously

Lesson 30. Promises

30.1. Using promises


30.2. Error handling
30.3. Promise helpers
Summary

Lesson 31. Advanced promises

31.1. Creating promises


31.2. Nested promises
31.3. Catching errors
Summary

Lesson 32. Async functions

32.1. Asynchronous code with generators


32.2. Async functions
32.3. Error handling in async functions
Summary

Lesson 33. Observables

33.1. Creating observables


33.2. Composing observables
33.3. Creating observable combinators
Summary

Lesson 34. Capstone: Canvas image gallery

34.1. Fetching images


34.2. Painting the images on the canvas
34.3. Repeating the process
Summary

Exercise answers

Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 20
Lesson 21
Lesson 23
Lesson 24
Lesson 25
Lesson 27
Lesson 28
Lesson 30
Lesson 31
Lesson 32
Lesson 33

Here’s a preview of some of the new syntaxes you’ll learn in unit


2
Here’s a preview of using promises and async functions from
unit 7

Index
List of Figures

List of Tables

List of Listings
Preface

I’ve been using ECMAScript-based languages for about 15


years. In fact, the first programming language I ever learned,
ActionScript, was based on ECMAScript. I kind of fell into
programming, but I’m so glad that I did. Originally I wanted to
be a graphic designer. I was always drawing, and by middle
school, I was making complex drawings pixel by pixel using
Microsoft Paint. In high school, I took a class on interactive
multimedia, and was introduced to Adobe Photoshop and
Macromedia Flash. Once I discovered the power of Photoshop,
I never wanted to go back and draw pixel by pixel ever again.
With Flash, I could take it even further: no longer confined to
creating still images, I could create rich animations.

This was the time of eBaum’s World and Newgrounds—


websites that showcased the communities’ Flash games. I
would visit these sites and wonder how these games were
created. I tried to teach myself ActionScript (Flash’s internal
language) purely by experimentation, but it wasn’t until I
bought my first programming book that I really learned. After
that, I was hooked. Being able to add interaction was a whole
new dimension over creating animations, just as creating
animations was a whole new dimension over creating still
images. But this was just the start of my journey.
Sometimes in my career, I learn something new that’s so much
more powerful than how I’ve been doing things that I never
want to go back. Most recently, after learning the power of all
the new features packed into ES2015 and later, I never want to
go back to how I did things before—and I hope you agree.
Acknowledgments

I would like to thank my wife Christina and our children, Talan


and Jonathan “Jam,” for all the time they sacrificed spending
with me as I worked hard on writing this book. I love you all.

I would also like to thank Manning, especially my editors Dan


Maharry, Nick Watts, and Candace West. I would like to extend
a special thank you to all the reviewers that made this book
even better: Aïmen Saïhi, Ali Naqvi, Brian Norquist, Casey
Childers, Ethien Daniel Salinas Domínguez, Fasih Khatib,
Francesco Strazzullo, Giancarlo Massari, Laurence Giglio,
Matteo Gildone, Michael J. Haller, Michael Jensen, Miguel
Paraz, Pierfrancesco D’Orsogna, Richard Ward, Sean Lindsay,
and Ticean Bennett.
About this book

Get Programming with JavaScript Next was written for


JavaScript programmers looking to learn the modern features
introduced in 2015 and later. Instead of focusing on a specific
version such as ES2015 or ES2016, I wanted to focus on the
best new features that a developer would run into and be
expected to understand when thrown into a modern JavaScript
development environment.
WHO SHOULD READ THIS BOOK

Any programmer, no matter their skill level, should get a lot


out of this book. This book doesn’t teach “how to program.”
Readers are expected to be somewhat comfortable
programming with classic JavaScript, but you don’t need to be
an expert in JavaScript to follow along.
HOW THIS BOOK IS ORGANIZED

This book is broken into cohesive units. Each unit follows a


specific theme such as functions or asynchronous coding. Each
unit is broken into lessons on a specific topic, and each lesson
starts with a priming question designed to get your gears
spinning in the right way before we start the lesson.
Throughout each lesson, there will be quick checks to make
sure you understand the core idea of a section before moving
on. At the end of each lesson is an exercise to help you take
what you’ve learned and apply it. At the end of each unit is a
capstone project that you’ll build using everything you’ve
learned throughout the unit.
ABOUT THE CODE

This book contains many examples of source code both in


numbered listings and inline with normal text. In both cases,
source code is formatted in a fixed-width font like
this to separate it from ordinary text. Sometimes code is also
in bold to highlight code that has changed from previous steps
in the chapter, such as when a new feature adds to an existing
line of code.

In many cases, the original source code has been reformatted;


we’ve added line breaks and reworked indentation to
accommodate the available page space in the book. In rare
cases, even this was not enough, and listings include line-
continuation markers ( ). Additionally, comments in the
source code have often been removed from the listings when
the code is described in the text. Code annotations accompany
many of the listings, highlighting important concepts.

The code used in this book may be accessed at the publisher’s


website (https://www.manning.com/books/get-programming-with-
javascript-next) or GitHub (https://github.com/jisaacks/get-
programming-jsnext).
BOOK FORUM

Purchase of Get Programming with JavaScript Next includes


free access to a private web forum run by Manning Publications
where you can make comments about the book, ask technical
questions, and receive help from the author and from other
users. To access the forum, go to
https://forums.manning.com/forums/get-programming-with-
javascript-next. You can also learn more about Manning’s
forums and the rules of conduct at
https://forums.manning.com/forums/about.

Manning’s commitment to our readers is to provide a venue


where a meaningful dialogue between individual readers and
between readers and the author can take place. It is not a
commitment to any specific amount of participation on the part
of the author, whose contribution to the forum remains
voluntary (and unpaid). We suggest you try asking the author
some challenging questions, lest his interest stray! The forum
and the archives of previous discussions will be accessible from
the publisher’s website as long as the book is in print.
Exploring the Variety of Random
Documents with Different Content
XXIX
TWO FAR JOURNEYS

I suppose you have wondered why I never mention Guy any more.
Well, he has gone away off to Boston to attend school. I well
remember when a new trunk was brought into the house, and
mistress packed all of his things into it so carefully. When it was very
nearly filled to the top, she tucked in a box of candy and four little
pictures; one of herself, one of a darling little girl, one of a beautiful
lady with a baby in her arms that had a white circle around his head,
and one of a group of kittens all standing in a row. On top of the
pictures and the candy she laid a new silk muffler, and a beautiful
soft, fluffy bath-robe, and before she could put in any more she had
to go down-stairs to see a caller.
I had been with mistress all the morning, watching the different
things she put into the trunk, and I felt myself getting quite sleepy; so
while she was down-stairs I crawled into the trunk to take my
morning nap, and I found a very cozy little place between the folds of
that beautiful robe.
I was just getting nicely settled, when I felt Budge crawling in from
the other side. “Isn’t this fine,” said he, as his nose touched mine;
and in less time than it takes to tell it, we were fast asleep in Guy’s
new trunk.
This was very pleasant, but imagine my feelings when I was rudely
awakened by being squeezed so hard that it is a wonder my body
has not ever since been flat instead of round; and as for making an
outcry, it was utterly impossible. But thanks to the kind Providence,
in an instant I felt the pressure released. Just then I heard mistress
say something about the trunk being too full, and before I got myself
out of the folds of the robe, her kind hands were upon me. As she
pulled me out of my hiding-place, she said, “For mercy sakes! cats!
did you want to go to Boston, too?” Then without another word she
quickly locked the trunk, for the expressman stood ready to take it
away. So you see how near we came to going to Boston with Guy.
After Guy had gone, some of mistress’ friends advised her to break
up housekeeping and to board.
“Just think how much cheaper it would be for you,” said Mrs. Cotton
one day; “and with no housekeeping to bother with, how much more
leisure time you would have.”
“I don’t know how I would employ my leisure more profitably,” said
mistress, “than in maintaining the dear home on which my boy’s
tenderest thoughts are centred, and around which cluster those
sacred memories that form the very ground-work of a wholesome
and rugged life. The very first letter he wrote me started out: ‘I am
seated by my window as the sun is setting over my dear western
home.’ Now, would he have such fond thoughts of his home, and
would he be likely to connect it with the beautiful spectacle of the
setting sun, were it reduced to a room in a boarding-house?”
“Again you have convinced me that your way of thinking is right,”
said Mrs. Cotton.
And so now, although Guy is no longer with us, we are still in our
dear home on Elmwood Place.
When the pleasant weather came again, mistress began to make
ready, as usual, for her summer outing. Of course, we did not expect
her to take us along this time, because we had heard that she was
going way off to her “dear Switzerland,” as she always calls it; and
judging from what they say, Switzerland must be even farther off
than Denver. But we knew that Bettie would be at home with us, so
we were content.
Just before mistress went on her long journey, a lovely young lady
came to help her get ready, and the very first day they got to talking
about us cats.
“You ought to get acquainted with Mrs. Bolton,” said Miss Cummings,
“for she is just as great a friend of cats as you are and her home is a
perfect haven for strays.”
“I am very glad to hear it,” said mistress. “Do please tell me about
her cats.”
“Yes,” said Miss Cummings, “Mrs. Bolton has fitted up a little shed at
the rear of her house, which is filled up in cold weather with loose
straw. Into this place stray or homeless cats and dogs crawl through
a small opening and find shelter. Moreover they are fed and made to
feel welcome. I have known her to have so many of these transient
boarders there that it takes several pounds of meat a day to supply
them; and as soon as they look sleek and plump Mrs. Bolton
generally finds good homes for them.”
“What you say is encouraging,” said mistress, “because I am often
criticised, and told that I would do better to lavish my attentions on
some neglected child, than on cats. But children have a hundred
friends where cats have none.”
“That’s just what I have heard Mrs. Bolton say,” replied Miss
Cummings.
“And furthermore I have found,” said mistress, “that my interest in
cats has increased my love for human beings, and indeed for all
living creatures.”
But to return to the journey. When mistress went away to Switzerland
three lovely young ladies came to live at our house, and Bettie kept
house for them. Toddy was living with Mrs. Smith and Budge and I
stayed at home. But if you should ask me how we spent the long
summer, I should have to tell you that we passed a good share of it
sitting on the front porch railing, where mistress had placed a shelf
behind the vines for our accommodation. There we sat day after day,
looking longingly up the street; each wanting to be the first to tell the
others the happy news of mistress’ return. At last the robins had
sung their good-bye songs, and the grasshoppers had taken their
departure. The leaves were beginning to fall but we did not find any
pleasure in chasing them, as we had other years. Our days were
passed wearily and sadly, till one morning the joyful news came that
mistress had arrived in New York. Oh! how it thrilled us with delight.
Budge ran across the street to tell Toddy, and we all went to work to
sleek ourselves up so as to look our very prettiest. I had at this time
three little kittens just ten days old, and they had that very morning
opened their eyes. They, too, had to come in for their share of
grooming.
The next morning after breakfast a carriage drove up to the curb,
and in it was our mistress. Toddy recognized her from way across
the street, and came over mewing a hearty welcome. Budge gave
vent to his feelings by means of the graceful curves and spirals of his
tail, and as for me, I welcomed her with a succession of winks.
As soon as mistress had greeted us all, she inquired after my kittens
just as if she knew all about them, and, of course, I showed them to
her with great delight and pride.
“Poor, dear Meow,” said she, “you tried to have a pleasant surprise
for my home-coming, didn’t you?”
I winked assent, and then she proceeded to name my babies. The
dainty little gray with white breast, she called Lady Jane Grey; the
tiger Patsy, and the black one Hiddigeigei, after a famous black cat
that lived many years ago in a beautiful castle on the Rhine, and in a
German book[3] you can read what an honorable and useful cat he
was.
When mistress took a second look at Toddy she seemed visibly
affected by the sad plight he was in, for he had been in failing health
all summer. His once beautiful body was flabby and wasted, and the
once bushy tail stringy, and almost bare. For several days Toddy
received mistress’ most lavish attention; then all of a sudden he
disappeared, and not one of us had any idea whither he had gone,
till one evening Mrs. Smith came over and inquired for him.
“I took him to the hospital,” said mistress, “but it was too late to save
him; and he has gone to the other side of Jordan.” Mrs. Smith said
she was very sorry to miss him, but that, after all, she thought that
was the best place for him.
So now, of course, although I don’t know where Jordan is, still I am
satisfied it must be a very good place for cats, if Mrs. Smith and
mistress think so; and perhaps I ought to have made the title of this
chapter read “Three Far Journeys” instead of two.
About the time mistress returned from Switzerland a lady and a
gentleman came to live across the street from us, and they brought
with them a white cat. Of course, after the way Nellie had treated us
we were in no great hurry to make the acquaintance of Snowdrop, as
they called him; but we used to watch him from our shelf on the
porch as he would have his ups and downs with Goldie, and we
soon discovered that he was very much like the rest of us in his daily
conduct. True, there were times when he would sit on his mistress’
sewing-table by the front chamber window, and groom and primp
himself just like Nellie, and try to look pretty; but the very same day
perhaps he would be rolling in the gutter as if he thought a dust bath
the very best thing to improve his appearance. Then also he was a
great fellow to explore the neighborhood, and after he had nosed
around in every nook and corner on his own side of the street he
came to our side one afternoon and went over into the corn-field.
Budge and I followed him, and after the formal greetings common to
cats, we lay down in a sunny corner and had an interchange of
views.
Snowdrop
“It seems to me you have a pretty lonesome time of it, alone all day,”
said Snowdrop, sprawling himself out on the sun-warmed earth as
he spoke.
We told him that we had become used to being alone during the day,
and what a kind mistress we had, and how we regretted her long
absence. Then he told us what a long journey he made with his
mistress all the way from a great city called Chicago to his present
home.
“Are Chicago cats all white like you?” said Budge.
“No, indeed,” replied Snowdrop, “my very best friend and constant
companion in Chicago was a black cat named Topsy. She hadn’t a
white hair on her whole body; and she was the mother of two kittens,
one all black with white slippers, and the other all white with black
tips on her ears and tail. And beside her I knew many other cats just
like these around here. So you see that Chicago cats are no different
from those in other cities.”
When I asked Snowdrop how he came to leave Chicago and make
such a long journey, he said:
“You see it was this way. One day a fine gentleman came to our
house, and then there was a great feast with flowers and music and
many beautiful ladies. But my mistress was the most beautiful of
them all, for she was dressed all in white. Topsy and I were there
too, all decked out with beautiful ribbons. But right in the midst of it
this young gentleman took my mistress and me away. I was put in a
large covered basket; but I did not mind it, so long as my dear
mistress was with me. I slept all night in a chair beside her bed, and
in the morning early I was again put into my basket. The next time
when it was opened I stepped out of it in my present beautiful home.
If only Topsy was here, my happiness would be complete.”
I told Snowdrop to come over and visit us whenever he felt homesick
for Topsy, and he thanked me very kindly. But just at that moment he
heard his mistress’ call, and like an obedient cat, he arose and went
home.
Budge and I promised ourselves many delightful times with
Snowdrop; but, sad to relate, that was the last we ever saw of him.
We never knew what had become of him till one day Goldie told us
that he saw a man pull Snowdrop off the porch-rail in front of his
house, and walk away with him.
Of course, his mistress was heart-broken when she discovered that
her pet had disappeared; and when, after every effort to find him,
she finally gave him up for lost, she came over and selected my little
Patsy to take Snowdrop’s place as soon as he should be old
enough. But I do hope that before that time comes, Patsy’s new
mistress will put up a shelf for him on her porch, high enough like
ours, so passers-by cannot reach him, and behind the vines, so he
can see without being seen.
Now I have told you about four far journeys instead of two.
XXX
THE BURGLAR MAN

Not very long after mistress’ return one evening just after dark a big
burglar man came into our house. I knew he was a burglar because
he crawled in through the window, and he went into all the rooms.
Budge was terribly afraid of him and hid himself under the ice-chest;
but Toddy and I followed him up-stairs to see what he would do. First
he pulled down all the shades, then lighted a little lamp which he
carried, and opened the closets and drawers, and mistress’ trunk. He
was just about to do up some of mistress’ most beautiful dresses into
a bundle, when I heard the sound of three very loud whistles on the
outside. At this the man instantly dropped everything and rushed
down-stairs; and just as he was running out of the back door, Bettie
came in at the side.
I did so wish I was big enough to grab him like Beautiful Joe did old
Jenkins, and hold unto him till she could catch him. But being only a
cat, of course, I could not do it. Still, if he had touched my kittens I
believe I should have summoned up all the tiger within me in my
efforts to defend them.
During the evening many of our neighbors came to the house to see
what the burglar had done, and from what they said I guess there is
no telling what he would have taken if the whistle hadn’t sounded
just when it did. For all I know he might have taken my babies too. At
any rate, I concluded to put them where he couldn’t find them, if he
ever came again.
Among the neighbors that called that evening was the gentleman
that had brought Snowdrop from Chicago. The moment he saw my
basket he inquired for Patsy, and mistress took him out and handed
him over to his future master.
“Feline stock is bound to rise,” said he, as he fondly petted Patsy; “it
is becoming the fashion now to have real cats in schools and
kindergartens, instead of mere pictures of them.”
“Yes,” said mistress, “the many-sided usefulness of the cat is
gradually becoming recognized. I had a vivid picture of her future
possibilities when on a visit to a hospital for insane, where I saw
sullen and turbulent men and women subdued and softened by the
winsome ways of a kitten; and the feelings that its presence seemed
to awaken within them seemed to me to point out a new way to
‘minister to a mind diseased.’”
The gentleman finally put Patsy back into my basket and I felt quite
relieved, for I had begun to fear from the way he praised and petted
him that he was going to take him away.
That night I hunted for a good hiding-place and before morning I had
my darlings all safely tucked away in the basement behind the
kindling.
It was no small task to carry each one down the stairs, for they were
now several weeks old; but you know a mother will endure almost
any hardship for the sake of her babies.
The poor little things had their rest so broken, that when mistress
and Bettie came down they were still sound asleep, and I went up-
stairs to get my breakfast at the usual time.
As soon as mistress missed my kittens she and Bettie began hunting
for them in every nook and corner, and they looked behind the
kindling pile several times; but I had put them in a hollow space
away back among the kindling where they could not be seen. After a
long search they gave it up, hoping they would come to light by
evening, and my poor babies lay all that day on the bare stone floor.
I soon discovered that I had made a mistake, for before night their
eyes were all watery, and they were sneezing a regular concert, so
that when mistress returned in the evening it did not take her long to
find them.
She brought them up-stairs and wrapped them in a flannel cloth.
Then she fixed our basket with a nice warm blanket, and set it in a
sheltered corner behind the cook-stove, and there she installed my
babies in their new quarters. For many days every morning and
evening she would take a basin of warm water, and with a soft cloth
wash out their eyes; for the discharge would make such a thick
coating as to close them up completely in a few hours. As the kittens
were too small to be fed medicine with a spoon, mistress had to
devise some new way of giving it to them. She dipped their paws
repeatedly into a mixture called catnip tea, and, of course, they
would lick it off.
But even with this ingenious invention it was some weeks before my
kittens recovered from the ill effects of that unhappy day on the
basement floor. I was very sorry to have caused my dear mistress so
much trouble, and my poor babies so much suffering, but I did it to
keep the horrid burglar man from finding them.
A few days after the burglar man had visited us, a handsome water
spaniel came to the house and begged for admittance, and mistress
very gladly took him in. I think the kind Providence sent him to
protect us, for from that time we have never been bothered with
burglars.
The dog was named Dennis, because he was the very image of our
old-time friend on Poplar Avenue. He and I became good friends at
once, but Budge resented his presence so bitterly that for many
weeks they could not be allowed in the same room; and it was only
by very slow degrees, as Budge saw that Dennis would not molest
him, that he came to tolerate him.
When my little kittens had become old enough to run about outdoors,
Dennis was very helpful. He would lie near the curb in front of the
house, and if one ventured out from the side of the house, he would
promptly drive him into the back yard. He was also fond of tantalizing
us at meal-time, when his meat was thrown out on the grass for him.
He would stand off, pretending he did not care for it, and just as
quick as one of us would attempt to go and take it, he would come
with a bound and a growl, and snatch it away from us, then drop it a
little further off, and repeat the operation.
Dennis was in the habit of absenting himself from us every week for
a day or two. Once he was absent several days, and upon his return
wore a beautiful collar, which, however, was missing when he
returned from his next trip. I suppose some folks thought they had
found a nice dog, and presented him with a collar; but finding him so
inconstant, they deprived him of it the next time he came around.
I must not forget to tell you of the very practical and effective way
that mistress has of teaching kittens to know and respond to their
names. As you probably know, she always gives a kitten a name as
soon as it is born. Then, whenever she picks up one, she keeps
repeating its name over and over as she pets it. She also
occasionally takes one away from the rest, up to her room or into the
library, and there, whether engaged in reading or writing, she looks
up every little while and talks to it, always calling it by name.
And right here let me tell you, a cat with a respectable name feels a
sense of dignity and self-respect that is impossible to one only
known by the general name of “kitty.” Moreover, it gives him a
chance to exercise promptness and obedience, qualities which are
sure to endear an animal to his master, because, when he hears his
name called, he can get right up and run, knowing that it means him
and not some other cat.
By the way, Bettie has left us, but it was for her good that she went,
and, of course, we would not be so selfish as to be sorry about it,
although we miss her sorely. Ever since Bettie came, mistress gave
her lessons almost every evening, and Bettie studied very
industriously every spare minute. Now she has gone to work in an
office and is living in a boarding-house.
“You are very foolish when you have a good housekeeper, to put
such high-faluting notions into her head,” said Mrs. Cotton, upon
hearing where Bettie had gone. “You might have had her for years, if
you had just left her alone.”
“That’s true,” said mistress. “But the pleasure of helping one who is
striving to better her condition fully repays for a little inconvenience.”
“You had her a year,” said Mrs. Cotton, “so you did better than most
people do, after all. These girls are always on the move.”
“It’s because most people look upon them as a mere convenience,”
said mistress, “instead of as fellow-beings with longings for
happiness and advancement like ourselves. Let housewives set
before their help a higher ideal and they will set in motion within
them forces which will root out the ever-present longing for shifting
about from place to place.”
Mrs. Cotton acted as if she did not quite agree with what mistress
said. She looked at her watch and said it was time for her to go; but
before leaving she came over to the bookcase where I had been
sitting and gave me a few gentle strokes.
XXXI
A FRIEND IN NEED

Just before Bettie went away, mistress brought home one evening
two little tiger kittens with white breasts and faces, but very thin and
haggard looking, and so distrustful. I heard her tell Mrs. Wallace that
she had brought them home to try and find homes for them.
“But I couldn’t recommend these kittens to anybody before I knew
something of their habits,” said mistress, “for if they turned out to be
troublesome it would hurt the reputation of our own kittens, and so
that is why I brought them home.” Mistress named them Billee and
Taffy, and started at once to put them through the usual course of
training to fit them for nice homes.
Taffy was a very quiet little fellow, but Billee was quite sociable. On
the day after his arrival I had occasion to do him a little favor, and in
expressing his thanks to me he grew quite talkative, and told me
something of his former life. Said he: “I was born in a stable that
stood in the rear of some stores, and we never had a mistress like
you have. Our master was very kind to his horse Jessie, and he
seemed to enjoy having us cats around after we got old enough to
play. But the old stable was so infested with fleas, we never had a
moment’s peace; and my poor mother became thin and gaunt trying
to keep herself and us looking respectable. That bath last night, I
dreaded it at first; but when I saw those fleas floating around in the
suds I thought I ought to be able to stand it for their sakes. If my
mother could have a bath like that and a brushing, and then lie down
peacefully on our clean soft pad, it would be bliss unheard of to her.
But she will never leave that dirty old stable so long as she and
Jessie can share it together, and indeed I don’t think she could have
a more devoted friend; for many a cold night did we sleep in Jessie’s
stall cuddled close up to her warm, sleek body. Near our stable was
a big hotel where our mother got daily many choice bits of meat and
fish, and this is how she made her living and raised her kittens; and I
tell you it was pretty hard work for her to carry enough food for so
many hungry little mouths.”
“How many were there of you?” said I.
“Six,” said Billee, “beside our dear mother, who always gave us the
best she had of everything.”
On the very same evening that mistress brought the little kittens
home, curiously enough we had another new arrival, a Maltese cat
with white markings. She came up the sidewalk in front of our house
crying as if in great distress. Mistress invited her into the house to
have some supper, but it was evident that hunger was not the cause
of her crying, for she did not touch a morsel of food. When mistress
examined her more closely, she found to her horror that the poor
thing’s breasts were greatly swollen, and that evidently, some one
had robbed her of her kittens. Then mistress picked up the two little
new kittens, and laid them on the pad by the old cat; and instantly
the little things began to nurse her, and were soon purring a happy
song of thankfulness. The “stepmother,” as mistress called the
strange cat, washed each kitten in true mother fashion, and for
several days enjoyed real mother bliss.
All this was very nice for the “stepmother,” but it proved disastrous to
the kittens, for both took sick and died. After that mistress rubbed the
old cat’s breasts daily with spirits of camphor, and in a few days she
seemed to be all right.
I asked the “stepmother” one day how she came to leave home at
such a critical time, and she unburdened to me a tale of cruelty and
abuse that is almost beyond belief. She said that there being no
other place provided, her kittens were born in the laundry basket,
and that on the next morning when they were discovered, the lady
ruthlessly dumped them out on the bare stone floor and ordered her
son to come and drown them. “So my poor babies were dropped into
a bucket of cold water right before my eyes,” said she, “and I was
powerless to save them.”
“Pray, who are these people,” said I, “that treated you in this
manner?”
“Their name is Morton,” said she, “and Will was the one that did the
deed; but he is not to blame. I remember years ago when he was a
most tender-hearted little fellow, and full of sympathy toward the
suffering. I shall never forget one bitter cold day when a kitten
followed him home from school and he carried it into the house and
begged to be allowed to keep it. His mother let it remain till Will’s
bedtime arrived, when she compelled him to put it outdoors, where it
cried bitterly for hours; and the next morning it was found on the
doorstep, frozen to death. And now that same mother wonders why
her son is so hard-hearted and brutal toward her.”
“I’ve heard of the Mortons before,” said I, “and I don’t blame you for
leaving them. But you are in good hands now—don’t fear.”
So the “stepmother” remained with us a few days longer, and then
she was taken by mistress to a beautiful home, where they wanted a
cat to live in the stable with the coachman.
One cold day last winter, there strayed into our basement two
strange cats, both tigers, but very unlike each other. One was sleek
looking, full-grown with beautiful, large eyes, and very confiding in
manner. The other was a shy, timid, shrinking little creature, afraid of
everybody, and yet hunger evidently had driven her to seek help at
our door. Her coat was so rough and dirty, it was difficult to tell what
its real color was, and one eye was completely gone from its socket.
She was indeed a pitiable sight, and I dare say very few people
would have allowed her to enter their door. Mistress prepared her a
plate of salmon, and the moment she smelled the odor, she began to
dance around as if she could hardly wait till it was ready. When at
last the plate was handed down to her she stepped into it with both
paws, and ate as greedily as any dog I ever saw. Mistress let her
have the dish all to herself, and fed the rest of us from a different
plate.
As soon as the poor creature’s hunger was appeased, without
stopping to wash, she went into a dark corner behind the cook-stove
and lay down to rest. While she thus lay there, mistress said to
Bettie, “It seems to me the kindest thing we can do to this poor
creature is to gently put her to sleep and end her troubles.”
“I think so, too,” said Bettie; “no one would care to have such an
unsightly animal around the house. She will never be anything but a
hapless vagabond, to whom death would be a blessing.”
But after all the little stranger was allowed to spend a few days of
real happiness, and when one morning we missed her, we knew that
she had gone to her long resting-place and was saved from further
sorrow.
As to the big cat, mistress said she felt sure that she must be
somebody’s pet, and she told Bettie not to let her out under any
circumstances.
Several days afterward Budge told me that during the first night of
the big cat’s stay with us she confided to him that her reason for
leaving her home was the fact that a new housekeeper who had
lately come, had just made her life unendurable; and that in utter
despair she had wandered away not knowing whither to go.
The very next day after the stranger arrived she became the mother
of five kittens. I dread to think what would have become of the poor
thing and her helpless babies on that cold winter night, if mistress
hadn’t allowed her to stay. But no doubt the kind Providence directed
her safely to our door.
A day or two after the little kittens came, there was a notice in the
newspaper: “Lost, strayed or stolen, a full-grown tiger cat. Leave at
‘The Elms’ and get reward.” When mistress saw it she sent word to
“The Elms” and they sent the coachman, who identified the cat and
took her and her kittens home, wrapped up in a Buffalo robe and
tucked in a laundry basket which he had brought in the coupé. The
people at “The Elms” were so grateful to mistress for sheltering their
pet that they sent her a basket of beautiful flowers.
Of course, it is not to be expected that every lady will turn her house
into an asylum for stray cats; but I have often heard mistress say,
and so I believe it is true, that many parents would have less cause
to mourn over selfishness and ingratitude in their children if they
would set a more generous and unselfish example before them in
their own treatment of dumb and helpless creatures.
XXXII
A KITTIE PARTY

When my kittens were of the proper age mistress proposed they


should have a chance to see all their little friends, so we sent out
invitations like this:
“Meow will give a coming-out party on Saturday next from
two till six, to her kittens Hiddigeigei, Lady Jane Grey and
Patsy, assisted by Booker T. Washington, Mollie Scott,
Budge and Goldie.”
The happy day came at last, sunshiny and bright, as if it had been
made expressly for our party, and at the appointed hour came also
our little guests. There were Marjory, Winifred, George and Doris,
and my new friends Frances, Arline, Earl, Lillian and Burt. These,
with Booker, Goldie, Budge, myself and the kittens, made just
sixteen in all.
Hiddigeigei, Patsy and Lady Jane Grey
Mollie Scott was also invited, but she did not come. After it was all
over she called and excused herself, saying she had never attended
a party, and didn’t know just how it would be; but that she had spent
most of the afternoon on the back fence, taking note of what was
going on, and that she thought another time she would venture to try
it. Said I, “The way to learn to do a thing is to do it, and you have
probably missed the chance of your life.”
At this Mollie gave me a very solemn look, and as she turned to go I
heard her mutter something to herself about “no use crying over
spilled milk.”
But to return to the party. Each of us big cats wore a wide ribbon
sash with a big bow tied at the back, but the little kittens wore narrow
ribbons tied around their necks. Goldie wore white, Booker crimson,
Budge blue, and I orange; and the kittens wore blue except
Hiddigeigei who wore pink. Our basket, handsomely decorated with
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like