mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-30 08:10:27 -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) {
|
letterOf (args) {
|
||||||
const index = Cast.toNumber(args.LETTER) - 1;
|
const index = Cast.toNumber(args.LETTER) - 1;
|
||||||
const str = Cast.toString(args.STRING);
|
const str = Cast.toString(args.STRING);
|
||||||
// Out of bounds?
|
// `charAt` handles out of bounds by returning an empty string.
|
||||||
if (index < 0 || index >= str.length) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return str.charAt(index);
|
return str.charAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue