fix some error in day 12

pull/113/head
Kamrul Islam Shahin 5 years ago
parent d6fbf69b66
commit 7985dc1b9d

@ -348,7 +348,7 @@ Zero or many times. The pattern could may not occur or it can occur many times.
```js ```js
const pattern = /[a].*/g //. any character, + any character one or more times const pattern = /[a].*/g //. any character, * any character zero or more times
const txt = 'Apple and banana are fruits' const txt = 'Apple and banana are fruits'
const matches = txt.match(pattern) const matches = txt.match(pattern)
@ -434,7 +434,6 @@ points = ['-1', '2', '-4', '-3', '-1', '0', '4', '8']
sortedPoints = [-4, -3, -1, -1, 0, 2, 4, 8] sortedPoints = [-4, -3, -1, -1, 0, 2, 4, 8]
distance = 12 distance = 12
``` ```
1. Write a pattern which identify if a string is a valid JavaScript variable 1. Write a pattern which identify if a string is a valid JavaScript variable
```sh ```sh
@ -484,7 +483,8 @@ distance = 12
``` ```
```sh ```sh
[{word:'love', count:6}, [
{word:'love', count:6},
{word:'you', count:5}, {word:'you', count:5},
{word:'can', count:3}, {word:'can', count:3},
{word:'what', count:2}, {word:'what', count:2},
@ -499,7 +499,7 @@ distance = 12
### Exercises: Level 3 ### Exercises: Level 3
1. Writ a function which cleans text. Clean the following text. After cleaning, count three most frequent words in the string. 1. Write a function which cleans text. Clean the following text. After cleaning, count three most frequent words in the string.
```js ```js
sentence = `%I $am@% a %tea@cher%, &and& I lo%#ve %tea@ching%;. There $is nothing; &as& mo@re rewarding as educa@ting &and& @emp%o@wering peo@ple. ;I found tea@ching m%o@re interesting tha@n any other %jo@bs. %Do@es thi%s mo@tivate yo@u to be a tea@cher!?` sentence = `%I $am@% a %tea@cher%, &and& I lo%#ve %tea@ching%;. There $is nothing; &as& mo@re rewarding as educa@ting &and& @emp%o@wering peo@ple. ;I found tea@ching m%o@re interesting tha@n any other %jo@bs. %Do@es thi%s mo@tivate yo@u to be a tea@cher!?`
@ -514,11 +514,12 @@ distance = 12
```js ```js
console.log(mostFrequentWords(cleanedText)) console.log(mostFrequentWords(cleanedText))
[{word:'I', count:3}, {word:'teaching', count:2}, {word:'teacher', count:2}]
``` ```
```sh
[{word:'I', count:3}, {word:'teaching', count:2}, {word:'teacher', count:2}]
```
🎉 CONGRATULATIONS ! 🎉 🎉 CONGRATULATIONS ! 🎉
[<< Day 11](../11_Day_Destructuring_and_spreading/11_day_destructuring_and_spreading.md) | [Day 13>>](../13_Day_Console_object_methods/13_day_console_object_methods.md) [<< Day 11](../11_Day_Destructuring_and_spreading/11_day_destructuring_and_spreading.md) | [Day 13>>](../13_Day_Console_object_methods/13_day_console_object_methods.md)
Loading…
Cancel
Save