Node.js examples for String:String Value
Get palindrome
var op = {//from w ww .j ava 2 s .co m palindrome: function(x, y) { var result = 0; var x_min = Math.pow(10, x - 1), x_max = Math.pow(10, x), y_min = Math.pow(10, y - 1), y_max = Math.pow(10, y); for (i = x_min; i < x_max; i++) { for (j = y_min; j < y_max; j++) { number = i * j; number_string = "" + number; number_reversed = number_string.reverse(); if (number_string == number_reversed && number > result) { result = number; } } } return (result > 0) ? result: "No Palindrome"; } }