0
私は物事を参照する関数を持っています。バグを修正するために、私は他のケースステートメントを削除しました(彼らは変更も問題も修正しません)。私はreturn
も削除しました。これは、この段階では無関係です。値が表示されているにもかかわらず、Null/Undefinedとしてのパラメータチェック
何かの理由で、Chrome Consoleにtype = 'id'
がif (type === null || "" || "undefined")
が毎回起動すると伝えているにもかかわらず、私はDOM内の要素を渡します。Referencer('id', 'hello')
この
if (type === null || "" || "undefined") {
でhttps://output.jsbin.com/secuciyeko
function Referencer(type, value) {
// Standard Declaration
"use strict";
// Open Console Group
window.console.groupCollapsed("[Scriptbase.js]/[Referencer] @ " + Scriptbase.Time());
// Log Status
window.console.info("[Process Started @ " + Scriptbase.Time() + "]");
/* ------- Computation ------- */
// Local Variables
var a = null;
// Log Status
window.console.log("[Success @ " + Scriptbase.Time() + "]: Checking for unusable values.");
// Value Validation
if (type === null || "" || "undefined") {
// Log Status
window.console.error("[Failure : " + Scriptbase.Time() + "] : Failure to look up '" + type + "' with the value '" + value + "'.");
// Close Console Group
window.console.groupEnd();
// Exit Method
return;
}
if (value === null || "" || "undefined") {
// Log Status
window.console.error("[Failure : " + Scriptbase.Time() + "] : Failure to look up '" + type + "' with the value '" + value + "'.");
// Close Console Group
window.console.groupEnd();
// Exit Method
return;
}
// Log Status
window.console.log("[Success : " + Scriptbase.Time() + "] : Looking up '" + type.toUpperCase() + "' with the value of '" + value + "'.");
// Look Up Value
switch (type) {
case "id":
// Variable Assignment
a = document.getElementById(value);
// Log Status
window.console.log("[Success : " + Scriptbase.Time() + "]: Found an DOM ID of '" + value + "'.");
// Break Case
break;
}
}