Once upon a time, overlooking the northern city of Javascript, stood an impressive statue of Array, the Happy Prince. His eyes were bright blue jewels, and his gold-leaf covered sword had a sparkly red jewel embedded in the handle. The citizens of Javascript took pride in the beautiful statue.
const prince = ['**','+',
'+','*','+',
'+',
'+',
'+']
One night, a little lone swallow migrating south, seeking the summer heat, was flying over the city when the statue caught her eye. She thought it would be a great place to spend the night, so she flew down and perched herself between the feet of the Happy Prince.
const prince = ['**','+',
'+','*','+',
'+',
'+',
'+']
const swallow = {}
As she was about to put her head under her wing, a large drop of water fell on her. She looked up.
“That’s strange,” she thought. “There isn’t a cloud in the sky, and yet it’s raining!” She looked up and saw that the eyes of the Happy Prince were full of tears.
“Why are you crying?” she asked the prince.
“I'm sad because from here I can see the whole city and how poor and hungry people are. Not far from here, I can see a poor woman sewing at a table. Her little boy is very ill. Little bird, will you take my red jewel to her?”
“I'm sorry,” said the swallow. “Winter is coming and I need to travel south.”
“Please little bird, stay with me for one night and do this one thing for me,” begged the prince.
The swallow accepted and took the big red jewel from the prince’s sword and flew away with it over the rooftops...
const prince = ['**','+',
'+','*','+',
'+',
'+',
'+']
const swallow = {}
swallow.beak = prince.splice(3,1)
console.log(swallow)
{
"beak": ["*"]
}
... she flew into the woman’s house and put the big red jewel on the table. When the woman found the jewel she felt very happy as she would now multiply the money she needed to help her son.
const woman = {}
woman.table = swallow.beak.pop()
console.log(woman)
{
"table": "*"
}
The next day, the swallow said to the prince, “Winter is almost here. I can't stay any longer. In the south the sun shines brightly and my friends are waiting for me.”
“But little bird,” said the prince, “Far away across the city I can see a poor student. He is sitting at a table covered with papers. At his side, there are some dead flowers. He’s trying to study for his exams, but he’s very cold and he can’t study. He’s weak and hungry. Please take my blue jewels to him.”
“If I do that you’ll go blind,” answered the swallow.
“It doesn't matter little bird, please do what I tell you.”
The swallow accepted, extracted the blue jewels from the statue of the prince and flew across the city...
const prince = ['**','+',
'+','+',
'+',
'+',
'+']
const swallow = {}
swallow.beak = prince.shift()
console.log(swallow)
{
"beak": ["**"]
}
...she flew into the student’s house and put the blue jewels on top of a book. When the student found them he was very happy as he would now exponentially multiply the money to buy food and pay for heating.
const student = {}
student.book = golondrina.beak.pop()
console.log(student)
{
"book": "**"
}
“You can’t see anymore, so I’ll stay with you,” said the swallow to the prince.
The next day, the prince asked the swallow to fly over the city and tell him all the things she saw. The bird flew through the dark streets and saw a group of very poor boys living under a bridge.
When the bird told the prince, he asked her to peel off the gold leaf that covered his sword bit by bit. The bird peeled off the gold leaf...
const prince = ['+',
'+','+',
'+',
'+',
'+']
const swallow = {}
swallow.beak = prince.splice(0)
console.log(swallow)
{
"beak": ["+", "+", "+", "+", "+", "+"]
}
... and took it to the boys who accepted it with joy. From now on they would sum enough money to buy food.
let boys = [{},{},{},{},{},{}]
boys = boys.map(boy => ({"mano": swallow.beak.shift()}))
console.log(boys)
[
{"mano": "+"},
{"mano": "+"},
{"mano": "+"},
{"mano": "+"},
{"mano": "+"},
{"mano": "+"}
]
But the Happy Prince was left lusterless and grey. The winter cold arrived and the poor swallow, not leaving his side, was already very weak and knew she only had a few days left to live.
const principe = []
const golondrina = {}
A few days later, the mayor of Javascript looked up at the statue and said, “The Happy Prince doesn’t look very cheerful. There’s even a dead bird at his feet!”
He ordered the statue to be pulled down and burned. But as they tried to set it on fire the heart remained intact so they threw it in the dumpster along with the dead swallow.
At that moment God said to his servants, Bring me the two best things in the city of Javascript.’ They brought Him the broken heart and the dead bird.
“You have choose wisely,“ said God. “As they represent the goodness and love of Javascript.“
Top comments (0)