js code for feature request 1522

Signed-off-by: A V Minhaz <minhazav@gmail.com>