Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

default in javascript

const greet = (message = 'Hello World!') => console.log(message);

greet(); // prints 'Hello World!'
greet('Hello! Does this answer your question?') // prints 'Hello! Does this answer your question?'
Comment

.default in javascript

function multiply(a, b) {
  b = (typeof b !== 'undefined') ?  b : 1
  return a * b
}

multiply(5, 2)  // 10
multiply(5)     // 5
Comment

default javascript

function say(message='Hi') {
    console.log(message);
}

say(); // 'Hi'
say('Hello') // 'Hello'
Comment

PREVIOUS NEXT
Code Example
Javascript :: mdn react 
Javascript :: js toggle div 
Javascript :: how to get a random item from an array javascript 
Javascript :: how to add animation over image in Javascript 
Javascript :: calculate days between two dates in javascript 
Javascript :: mongoose model schema 
Javascript :: random password generator javascript 
Javascript :: how to validate date in react 
Javascript :: python to java script 
Javascript :: close browser tab using jquery 
Javascript :: days.js 
Javascript :: id in class selector jquery 
Javascript :: TextInput cursor not shown react native 
Javascript :: angular conditional tooltip 
Javascript :: solid in css 
Javascript :: how to see javascript code in chrome 
Javascript :: js number format space 
Javascript :: creating a custom function to use nodemailer to send email 
Javascript :: change h2 to h1 using javascript 
Javascript :: javascript round big numbers 
Javascript :: eaf doom emacs 
Javascript :: @hapi/disinfect 
Python :: python check if path does not exist 
Python :: drop the last row of a dataframe 
Python :: ParserError: Error tokenizing data. C error: Expected 1 fields in line 87, saw 2 
Python :: how remove name of index pandas 
Python :: python spawn shell 
Python :: how to install pyaudio 
Python :: python install pip 
Python :: python upgrade pip scipy 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =