Tutorial by Examples

Fast and short way to extract extension from file name in JavaScript will be: function get_extension(filename) { return filename.slice((filename.lastIndexOf('.') - 1 >>> 0) + 2); } It works correctly both with names having no extension (e.g. myfile) or starting with . dot (e.g. .h...
Fast and short way to format value of type Number as money, e.g. 1234567.89 => "1,234,567.89": var num = 1234567.89, formatted; formatted = num.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); // "1,234,567.89" More advanced variant with support of any number o...
function assign(obj, prop, value) { if (typeof prop === 'string') prop = prop.split('.'); if (prop.length > 1) { var e = prop.shift(); assign(obj[e] = Object.prototype.toString.call(obj[e]) === '[object Object]' ? obj[e] ...

Page 1 of 1