// Сайт: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Operators/instanceof // Создание функции проверки, что переменная является объектом if (!Array.isArray) { Array.isArray = function(arg) { return Object.prototype.toString.call(arg) === '[object Array]'; }; } // Все следующие вызовы вернут true Array.isArray([]); Array.isArray([1]); Array.isArray(new Array()); // Небольшой факт: Array.prototype сам является массивом: Array.isArray(Array.prototype); // Все следующие вызовы вернут false Array.isArray(); Array.isArray({}); Array.isArray(null); Array.isArray(undefined); Array.isArray(17); Array.isArray("Array"); Array.isArray(true); Array.isArray(false); Array.isArray({ __proto__: Array.prototype }); // Проверка на float var _floatNumber = 9.22; var _notFloatNumber = 9; console.log(isFloat(_floatNumber )); // true console.log(isFloat(_notFloatNumber )); // false console.log(isFloat('')); // false function isFloat(n){ return Number(n) === n && n % 1 !== 0; } // Получить стили с загруженной страницы // https://developer.mozilla.org/ru/docs/Web/API/CSSRule var output = ""; function export_ss(ssel) { try { if(!ssel.cssRules) { return; } } catch(e) { if(e.name !== "SecurityError") { throw e; } return; } for(var i = 0; i < ssel.cssRules.length; i++) { var rule = ssel.cssRules[i]; output += rule.cssText + "\r\n"; } } for(var si = 0; si < window.document.styleSheets.length; si++) { output += "/* stylesheet #" + si + " */\r\n"; export_ss(window.document.styleSheets[si]); output += "/* end of #" + si + " */\r\n\r\n"; } document.getElementById("ss_output").value = output;