correction Java to JavaScript