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
{{ message }}
Repository navigation
Commit 4c83857
Browse filesBrowse the repository at this point in the historyBrowse files
//Prediction - The code would not run because 'cardNumber' is declared as numbers instead of a string.
14
14
// The '.slice()' method belongs to strings and arrays, it could only work by treating it's subject as a sequence of characters.
15
15
16
-
console.log(last4Digits);
16
+
console.log(last4Digits);
17
+
18
+
//Error message - TypeError: cardNumber.slice is not a function
19
+
//Reason for error
20
+
//The error thrown was considerably as predicted.
21
+
//'.slice()' is a method defined on 'String.prototype', and since 'cardNumber' was declared with a numeric literal, JavaScript treats it as the 'number' type.
0 commit comments