“JavaScript Console Console.log” Kode Jawaban

JavaScript Console Console.log

console.log('%cconsole.log', 'color: green;');
console.info('%cconsole.info', 'color: green;');
console.debug('%cconsole.debug', 'color: green;');
console.warn('%cconsole.warn', 'color: green;');
console.error('%cconsole.error', 'color: green;');
Pudochu

JavaScript Console Console.log

const styles = ['color: green', 'background: yellow'].join(';');

const message = 'Some Important Message Here';

// 3. Using the styles and message variable
console.log('%c%s', styles, message);
Pudochu

JavaScript Console Console.log

console.log(
  'Nothing here %cHi Cat %cHey Bear', // Console Message
  'color: blue',
  'color: red', // CSS Style
);
Pudochu

JavaScript Console Console.log

// 1. Pass the css styles in an array
const styles = [
  'color: green',
  'background: yellow',
  'font-size: 30px',
  'border: 1px solid red',
  'text-shadow: 2px 2px black',
  'padding: 10px',
].join(';'); // 2. Concatenate the individual array item and concatenate them into a string separated by a semi-colon (;)

// 3. Pass the styles variable
console.log('%cHello There', styles);
Pudochu

Jawaban yang mirip dengan “JavaScript Console Console.log”

Pertanyaan yang mirip dengan “JavaScript Console Console.log”

Lebih banyak jawaban terkait untuk “JavaScript Console Console.log” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya