LoginSignup
4
0

More than 3 years have passed since last update.

仕事の合間にconsole.?og

Last updated at Posted at 2020-05-01

まえがき

コ○ナのせいで外出できず、暇だったので作りました。
味気ないconsole.logに飽きたら使ってみてください。

使用例

ソースコード

index.html
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <script src="console.js"></script>
    <script>
    console.cog("hoge");
    console.dog("hoge");
    console.fog("hoge");
    console.hog("hoge");
    console.jog("hoge");
    </script>
  </body>
</html>

結果

console.png

スクリプト(コピペ用)

console.js
/***
 * Params are
 * s(speaker), w(word), l(length)
 */
console.xog = function(s, w, l) {
    console.log(`
      / ̄${` ̄`.repeat(l)}${s} < ${w}
      \\_${`_`.repeat(l)}_
    `);
}

console.cog = function(oil, l=oil.length/2) {
    console.xog("", oil, l);
};

console.dog = function(bark, l=bark.length/2) {
    console.xog("🐶", bark, l);
};

console.fog = function(moisture, l=moisture.length/2) {
    console.xog("🌫", moisture, l);
};

console.hog = function(grunt, l=grunt.length/2) {
    console.xog("🐷", grunt, l);
};

console.jog = function(wind, l=wind.length) {
    console.log(`🏃🏽${`💨`.repeat(l)}`);
};
4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0