JSFiddle - React, Tailwind, and code Playground

by mahny

HTML

<div>ホストがlocalhostのみ出力をするconsole.log()みたいなやつ</div>
<dl>
    <dt>ホスト</dt>
    <dd>
        <input id="inputHost" type="text" value="fiddle.jshell.net" />
        <button onclick="Debugger.log(location)">出力</button>
    </dd>
</dl>

JavaScript

const Debugger = {
	log: (msgObj) => {
    	const inputText = document.getElementById('inputHost').value;
    	if (location.host === inputText) {
        	console.log(msgObj);
        } else {
        	console.log('*****');
        }
    },
}