Course
What is Python?Aliasesand operatorArraysBooleansClassesCode blocksCommentsConditional statementsConsoleData structuresdatetime moduleDecoratorDictionariesDocstringsenumenumerate() functionEquality operatorException handlingFalseFile handlingFilter()FloatsFor loopsFormatted stringsFunctionsGeneratorGlobals()Greater than operatorGreater than or equal to operatorIf statementin operatorIndicesInequality operatorIntegersIteratorLambda functionLess than operatorLess than or equal to operatorList append() methodList comprehensionList count()List insert() methodList pop() methodList sort() methodListsLoggingmap() functionMatch statementMath moduleMerge sortMin()ModulesMultiprocessingMultithreadingNonenot operatorOOPor operatorParametersprint() functionProperty()Random modulerange() functionRecursionReduce()Regular expressionsrequests Libraryreturn statementround() functionSetsSQLiteString decode()String find()String join() methodString replace() methodString split() methodString strip()StringsTernary operatortime.sleep() functionTruetry...except statementTuplesVariablesWhile loopsZip function
JavaScript Program to Write to Console
Example: Using console.log()
// program to write to console
// passing number
console.log(8);
// passing string
console.log('hello');
// passing variable
const x = 'hello';
console.log(x);
// passing function
function sayName() {
return 'Hello John';
}
console.log(sayName());
// passing string and a variable
const name = 'John';
console.log('Hello ' + name);
// passing object
let obj = {
name: 'John',
age: 28
}
console.log(obj);
Output
8
hello
hello
Hello John
Hello John
{
age: 28,
name: "John"
}
The console.log() method is used to write to the console. You can pass values directly into the method or pass a variable to write to a console.