This commit is contained in:
Johan Milanov 2025-05-04 02:06:28 +00:00 committed by GitHub
commit a9d5a186d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -97,10 +97,7 @@ class Scratch3OperatorsBlocks {
letterOf (args) {
const index = Cast.toNumber(args.LETTER) - 1;
const str = Cast.toString(args.STRING);
// Out of bounds?
if (index < 0 || index >= str.length) {
return '';
}
// `charAt` handles out of bounds by returning an empty string.
return str.charAt(index);
}