Day 9 (30th Sep, 2020)
Routes,
Javascript (Problems)
Layout Route:
Step 1: Create 2 or more layout components like MainLayout, Layout2.
Step 2: Create LayoutRoute component, which will display other layouts.
Step 3. In app.js,
import Mainlayout, Layout2, and LayoutRoute.
Step 4: Create Route using LayoutRoute instead of Route.
Today's Problem:
Reverse the String:
For example: apple, you should return elppa,
cat, = tac
Method 1:
some input and some output
function reverseString(str) {
// Step 1: Convert the string to Array. cat, ['c', 'a', 't']
const arr = str.split('');
// Step 2: Array, reverse, ['t', 'a', 'c']
const reverseArr = arr.reverse();
// Step 3: Convert array to string and return it.
const finalStr = reverseArr.join('');
return finalStr;
}