logarithm js code example Example 1: javascript natural log Math.log(n) Example 2: calculate log in javascript var value = Math.log(2);