Some helpful Javascript Snippets. Click on it to see all.
Bazı faydalı Javascript kod parçacıkları. Hepsini görmek için tıklayın.
function getMonthName(monthNum) { | |
var monthNames = ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"]; | |
if (monthNum == null) { | |
var d = new Date(); | |
return monthNames[d.getMonth()]; | |
} else { | |
return monthNames[monthNum - 1]; | |
} | |
} |
function getRandomInt(min, max){ | |
if(min == undefined|| min == null) min = 0; | |
if(max == undefined|| max == null) max = 1000000; | |
return Math.floor(Math.random() * (max - min + 1) + min); | |
} |
String.prototype.contains = function(substr) { | |
if (this.indexOf(substr) === -1) { | |
return false; | |
} else { | |
return true; | |
} | |
} |