mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-14 22:41:20 -04:00
Remove useless bounds check
This commit is contained in:
parent
1201a2f1bc
commit
a3f1fb7956
1 changed files with 1 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue