We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2190b92 commit 50091d2Copy full SHA for 50091d2
String/ReverseWords.js
@@ -1,3 +1,19 @@
1
+/*
2
+* Doctests
3
+*
4
+* > reverseWords('I Love JS')
5
+* 'JS Love I'
6
+* > reverseWords('Hello World')
7
+* 'World Hello'
8
+* > reverseWords('The Algorithms Javascript')
9
+* 'Javascript Algorithms The'
10
+* > reverseWords([])
11
+* ! TypeError
12
+* > reverseWords({})
13
14
+* > reverseWords(null)
15
16
+*/
17
const reverseWords = (str) => {
18
if (typeof str !== 'string') {
19
throw new TypeError('The given value is not a string')
0 commit comments