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 :: js array string includes 
Javascript :: js multiline string with variables 
Javascript :: Selectores de jQuery CSS básicos 
Javascript :: openstreetmap api example javascript 
Javascript :: native module rnc_asyncsqlitedbstorage tried to override asyncstorage module 
Javascript :: next js get query parameters 
Javascript :: how to use promise.all 
Javascript :: react new project 
Javascript :: JavaScript querySelector - By Tag name 
Javascript :: Warning: Internal React error: Expected static flag was missing. Please notify the React team. 
Javascript :: mail testing 
Javascript :: angular add ellipsis to template string 
Javascript :: get last element in array javascript 
Javascript :: ng-true-value 
Javascript :: how to pass props to another component 
Javascript :: javascript copy clipboard 
Javascript :: remove whitspace in js 
Javascript :: upload bloob javascript 
Javascript :: react usereducer hook 
Javascript :: how to use axios 
Javascript :: logical operators in javascript 
Javascript :: how to make a div auto refresh js 
Javascript :: accessing json data 
Javascript :: unknown provider angularjs 
Javascript :: Generate a random Id safely 
Javascript :: jQuery - Remove 
Javascript :: merge two sorted linked lists 
Javascript :: array from javascript 
Javascript :: function js 
Javascript :: es6 foreach dom element 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =