Postingan

Menampilkan postingan dari Februari, 2012

JavaScript how to count of length the array

var lost = [4, 8, 15, 16, 23, 42]; var count = lost.length; var isLost = function (n) {   for ( i=0; i<6; i++ ) {     if ( n === lost[i]) {       return true;     }   }   return false; }; if ( isLost(12) ) {   console.log('12 is a lost number'); } if ( isLost(16) ) {   console.log('16 is a lost number'); }

JavaScript make squaring

var square = function (x) {   x = x * x;   return x; }; square(3);

ruby on rails Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

tambahkan di gemfile, 1. gem 'therubyracer' 2. jalankan bundle install lagi 3. jalankan rails s