exercise level2 complete

pull/266/head
adamascencio 3 years ago
parent e8568e8c9e
commit 5b6df407c4

@ -0,0 +1,13 @@
export const countries = [
'Albania',
'Bolivia',
'Canada',
'Denmark',
'Ethiopia',
'Finland',
'Germany',
'Hungary',
'Ireland',
'Japan',
'Kenya',
];

@ -8,6 +8,6 @@
</head> </head>
<body> <body>
<h1>30 Days of React - Day 1</h1> <h1>30 Days of React - Day 1</h1>
<script src="./level1.js"></script> <script type="module" src="./level1.js"></script>
</body> </body>
</html> </html>

@ -1,28 +1,7 @@
// Exercises: Level 1 import { countries } from './countries.js';
const countries = [ import { webTechs } from './web_techs.js';
'Albania',
'Bolivia',
'Canada',
'Denmark',
'Ethiopia',
'Finland',
'Germany',
'Hungary',
'Ireland',
'Japan',
'Kenya',
]
const webTechs = [ // Exercises: Level 1
'HTML',
'CSS',
'JavaScript',
'React',
'Redux',
'Node',
'MongoDB',
]
// Exercises
// 1. // 1.
const arr = []; const arr = [];
// 2. // 2.
@ -109,3 +88,30 @@ console.log('22. ', removeLastCompany);
// 23. // 23.
const removeAllCompanies = itCompanies.splice(0, itCompanies.length); const removeAllCompanies = itCompanies.splice(0, itCompanies.length);
console.log('23. ', removeAllCompanies); console.log('23. ', removeAllCompanies);
// Exercises: Level 2
// 2.
let text = 'I love teaching and empowering people. I teach HTML, CSS, JS, React, Python.'
text = text.replace(/[.,]/g, '');
const words = text.split(' ');
console.log(text);
console.log(words);
console.log(words.length);
// 3.
const shoppingCart = ['Milk', 'Coffee', 'Tea', 'Honey'];
shoppingCart.unshift('Meat');
shoppingCart.push('Sugar');
const honeyIndex = shoppingCart.indexOf('Honey');
shoppingCart.splice(honeyIndex, 1);
const teaIndex = shoppingCart.indexOf('Tea');
shoppingCart.splice(teaIndex, 1, 'Green Tea');
console.log(shoppingCart);
// 4.
countries.includes('Ethiopia') ? console.log('4. ETHIOPIA') : countries.push('Ethiopia');
// 5.
webTechs.includes('Sass') ? console.log('5. Sass is a CSS preprocess') : webTechs.push('Sass');
// 6.
const frontEnd = ['HTML', 'CSS', 'JS', 'React', 'Redux'];
const backEnd = ['Node', 'Express', 'MongoDB'];
const fullStack = frontEnd.concat(backEnd);
console.log(fullStack);

@ -0,0 +1,9 @@
export const webTechs = [
'HTML',
'CSS',
'JavaScript',
'React',
'Redux',
'Node',
'MongoDB',
];
Loading…
Cancel
Save