continued fun with arrays

pull/255/head
hollowmatt 3 years ago
parent 906e1f08ee
commit 47a6e64d81

6
package-lock.json generated

@ -0,0 +1,6 @@
{
"name": "30-Days-Of-React",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

File diff suppressed because it is too large Load Diff

@ -2,8 +2,33 @@ import './App.css';
function App() {
const ary = [1, 2, 3, 4];
const numbers = [0, 3.14, 9.81, 37, 98.6, 100] // array of numbers
const fruits = ['banana', 'orange', 'mango', 'lemon'] // array of strings, fruits
const vegetables = ['Tomato', 'Potato', 'Cabbage', 'Onion', 'Carrot'] // array of strings, vegetables
const animalProducts = ['milk', 'meat', 'butter', 'yoghurt'] // array of strings, products
const webTechs = ['HTML', 'CSS', 'JS', 'React', 'Redux', 'Node', 'MongDB'] // array of web technologies
const countries = ['Finland', 'Denmark', 'Sweden', 'Norway', 'Iceland'] // array of strings, countries
const phrase = "Catnip is a bad cat!";
//create arrays using split
const wordsInPhrase = phrase.split(" ");
const charsInPhrase = phrase.split("");
const staticFill = Array(6).fill('-');
const fruitsAndVeggies = fruits.concat(vegetables);
//output of exercises
console.log(ary.length);
console.log(ary.toString());
console.log(wordsInPhrase);
console.log(charsInPhrase);
console.log(wordsInPhrase[0]);
console.log(wordsInPhrase[0]='Milkshake');
console.log(wordsInPhrase);
console.log(staticFill);
console.log(fruitsAndVeggies);
console.log(fruitsAndVeggies.includes('fudge'));
return (
<div className="App">
<p>Array:

Loading…
Cancel
Save