You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/chapters/functions/exercises.rst
+15-9
Original file line number
Diff line number
Diff line change
@@ -45,8 +45,16 @@ Rectangles
45
45
46
46
#####
47
47
48
-
#. Write a function ``makeSquare(size)`` that returns an ``size`` by ``size``
49
-
square of hashes. Use your ``makeLine`` function to do this.
48
+
#. Write a function called ``makeSquare(size)`` that returns a ``size`` by
49
+
``size`` string of hashes. The function should NOT print each row of the
50
+
square. Instead, it must return a single string that contains the entire
51
+
shape.
52
+
53
+
.. admonition:: Tip
54
+
55
+
#. Call your ``makeLine`` function to create each row of the square.
56
+
#. The newline character, ``\n``, will be helpful to you.
57
+
#. Do NOT include a newline character at the end of your string.
50
58
51
59
.. sourcecode:: js
52
60
@@ -62,14 +70,12 @@ Rectangles
62
70
#####
63
71
#####
64
72
65
-
.. tip::
66
-
67
-
The newline character, ``\n``, will be helpful to you.
68
-
69
-
.. warning::
70
-
71
-
For this and all other functions in these exercises, make sure you do NOT have a newline character at the end of your string. Not only will ``console.log`` add a newline there for you, but having an extra newline at the end will make life harder for you toward the end of the exercises.
73
+
.. admonition:: Warning
72
74
75
+
For each of the shape exercises, do not include a newline character at
76
+
the very end of your string. While the final ``\n`` might not be
77
+
noticeable for the simpler shapes, including it will make life harder for
78
+
you toward the end of the exercises.
73
79
74
80
#. Write a function ``makeRectangle(width, height)`` that returns a
75
81
rectangle with the given width and height. Use your ``makeLine`` function to
0 commit comments