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
// TODO: Write a function that takes an Optional<number> and adds 3 to the number
152
+
153
+
// TODO: Write a function that takes an Optional<string> and prefixes the string with "hello"
154
+
155
+
// TODO: If the below function is called, does it return a value or throw an exception? Write your answer in a comment, and explain why you think it behaves this way?
156
+
constwillItKersplode=(): Optional<string>=>{
157
+
constz=Optional.none<string>();
158
+
returnz.map<string>((s)=>{
159
+
thrownewError("boom");
160
+
});
161
+
};
162
+
132
163
/*
133
164
Well done! You've tackled the basis of Optionals. We'll dig into them a bit more in future exercises,
134
165
but everything builds on what we've done here.
135
166
136
167
TODO: head over to Exercise3OptionTest to write some test cases for the above.
168
+
*/
137
169
138
170
139
-
171
+
/*
140
172
Below are some explanatory notes on some more advanced topics. Feel free to skip them if you're still learning.
0 commit comments