JavaScript code for PE problem 297 added.