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
// I predict the code will give an error because inside the function we create a variable called str again.
4
4
// call the function capitalise with a string input
5
5
// interpret the error message and figure out why an error is occurring
6
6
@@ -9,5 +9,10 @@ function capitalise(str) {
9
9
returnstr;
10
10
}
11
11
12
+
console.log(capitalise("hello"));
12
13
// =============> write your explanation here
14
+
// The error occurs because we are trying to declare a variable named str inside the function, but it is already declared as a parameter. This creates a conflict and results in a syntax error.
0 commit comments