Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
michelleenoe committed Feb 13, 2024
1 parent 6b9e854 commit 2c22a14
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
24 changes: 6 additions & 18 deletions animalBase_second/animals.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
[
{
"name": "Mandu",
"desc": "the amazing",
"type": "cat",
"fullname": "Mandu the amazing cat",
"age": 10
},
{
"name": "Mia",
"desc": "the black",
"type": "cat",
"fullname": "Mia the black cat",
"age": 10
},
{
"name": "Leeloo",
"desc":"the growing",
"type":"dog",
"fullname": "Leeloo the growing dog",
"age": 3
},
{
"name": "Toothless",
"desc": "the trained",
"type":"dragon",
"fullname": "Toothless the trained dragon",
"age": 14
},
{
"name": "ScoobyDoo",
"desc": "the wondering",
"type": "dog",
"fullname": "ScoobyDoo the wondering dog",
"age": 58
},
{
"name": "Horsey",
"desc":"the horsing",
"type":"horse",
"fullname": "Horsey the horsing horse",
"age": 10
}
]
2 changes: 1 addition & 1 deletion animalBase_second/animals_basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>Animals - basic</h1>
<li><span data-field="fullname">XX</span> is <span data-field="age">YY</span> years old</li>
</template>

<script src="animals_objects.js"></script>
<script src="animals_basic.js"></script>
</body>
</html>

12 changes: 6 additions & 6 deletions animalBase_second/animals_objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
window.addEventListener("DOMContentLoaded", start);

const Animal = {
name: "-hei",
desc: "-no",
type: "ok",
age:0
name: "-hei-",
desc: "-no-",
type: "-ok-",
age: 0

}
};

const allAnimals = [];

Expand Down Expand Up @@ -41,7 +41,7 @@ function prepareObjects( jsonData ) {

const firstSpace = fullname.indexOf(" ");
const secondSpace = fullname.indexOf(" ", firstSpace + 1);
const lastSpace = fullname.lastindexOf(" ");
const lastSpace = fullname.lastIndexOf(" ");

const name = fullname.substring(0,firstSpace);
const desc = fullname.substring(secondSpace + 1,lastSpace);
Expand Down

0 comments on commit 2c22a14

Please sign in to comment.