why this javascript execute code dont work on openbullet and work in javascript test sites ?



  • this code work on javscript test sites but not work in openbullet why ?

    BEGIN SCRIPT JavaScript
     function submission(length)
    {
            var result = '';
            var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
            for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
            return result;
    }
    var submission110 = submission(32);
    END SCRIPT -> VARS "submission110"
    


  • @amrmostafa800
    Check if this is the expected result

    FUNCTION Constant "32" -> VAR "length" 
    BEGIN SCRIPT JavaScript
    var result = '';
    var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
    END SCRIPT -> VARS "result"
    

    Result.PNG



  • i check my code and found space before function submission(length) when i remove space it work
    thanks for help

    BEGIN SCRIPT JavaScript
    function submission(length)
    {
            var result = '';
            var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
            for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
            return result;
    }
    var submission110 = submission(32);
    END SCRIPT -> VARS "submission110"
    

Log in to reply