Skip to content

Commit 977ea8d

Browse files
committed
js-week4-char-count-exercise
1 parent 4b006a4 commit 977ea8d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

courses/foundation/intro-to-javascript/week4/session-plan.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,20 @@ Write a function that counts the frequency of characters in a string:
113113
```js
114114
console.log(getCharacterFrequencies("happy"));
115115
/*
116+
{
117+
h: 1,
118+
a: 1,
119+
p: 2,
120+
y: 1
121+
}
122+
*/
123+
```
124+
125+
The expected output above allows for a relatively simple solution mechanism. Think about object property accessors.
126+
For a bigger challenge, you can try to write the same function for a different exptected output as seen bellow. It will require implementing some additional logic.
127+
128+
```js
129+
/*
116130
{
117131
characters: [
118132
{
@@ -132,7 +146,7 @@ console.log(getCharacterFrequencies("happy"));
132146
count: 1
133147
}
134148
], length: 5
135-
}
149+
}
136150
*/
137151
```
138152

0 commit comments

Comments
 (0)