fix: isPrime block should cast str as num (#5680)

Fixes #5678
This commit is contained in:
Neil Fraser
2021-11-05 11:12:25 -07:00
committed by GitHub
parent 3746688ebd
commit 1c3f4f0524
2 changed files with 2 additions and 2 deletions

View File

@@ -157,7 +157,7 @@ Blockly.JavaScript['math_number_property'] = function(block) {
'mathIsPrime',
['function ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ + '(n) {',
' // https://en.wikipedia.org/wiki/Primality_test#Naive_methods',
' if (n === 2 || n === 3) {',
' if (n == 2 || n == 3) {',
' return true;',
' }',
' // False if n is NaN, negative, is 1, or not whole.',