Petty Prison

by Rey Den Nalasa

JavaScript

var mystr = "Standing on the left side of the escalator";

//Splitting it with : as the separator
var myarr = mystr.split(" ");


function convert_to_ascii(some_string){
	var ascii_total = 0;
  for (var i = 0; i < some_string.length; i++) {
    console.log(some_string.charCodeAt(i));
    ascii_total += some_string.charCodeAt(i);
  }
  return ascii_total;
}

var all_asci_total = 0;
myarr.forEach(function(element) {
//  console.log(element);
	all_asci_total += convert_to_ascii(element);

});

//console.log(all_asci_total);

var final_time = Math.pow(all_asci_total,3);

console.log(final_time);

hours = Math.floor(final_time / 3600);
final_time %= 3600;
minutes = Math.floor(final_time / 60);
seconds = final_time % 60;

console.log(hours);