It’s an arrow function, newly defined in ES6.
An arrow function expression has a shorter syntax than a function expression and does not bind its own this, arguments, super, or new.target. Arrow functions are always anonymous. These function expressions are best suited for non-method functions, and they cannot be used as constructors.
They are often just a shorter way of writing the anonymous function function () {}
, with which you may already be familiar.
These pieces of code do the same thing:
setTimeout(function () { console.log("Hey"); }, 1000);
setTimeout(() => { console.log("Hey"); }, 1000);
This means that in your example http.createServer
is accepting one argument, a function which itself takes two arguments.
Arrow functions are not equivalent to function () {}
anonymous functions, function () {}
binds its own this
, for example.
Related Posts:
- Can I use complex HTML with Twitter Bootstrap’s Tooltip?
- How do I redirect to another webpage?
- Invariant Violation: Objects are not valid as a React child
- “SyntaxError: Unexpected token < in JSON at position 0"
- How can a Discord bot create a hyperlink in a Discord message in an embed or in general? [closed]
- SyntaxError: Unexpected token o in JSON at position 1
- Uncaught ReferenceError: jQuery is not defined [duplicate]
- syntax error: unexpected token <
- How to define type for a function callback (as any function type, not universal any) used in a method parameter
- Error OPTIONS net::ERR_CONNECTION_REFUSED
- Disabling and enabling a html input button
- How do I test for an empty JavaScript object?
- TypeScript React.FC
confusion - Check if checkbox is checked with jQuery
- What is an unhandled promise rejection?
- What is a good regular expression to match a URL? [duplicate]
- Infinite Scrolling in Asp.Net MVC with jQuery / AJAX Issues
- What are the difference between $(document).bind(‘ready’, function) and $(document).ready(function() {})
- Getting “TypeError: failed to fetch” when the request hasn’t actually failed
- How to randomize (shuffle) a JavaScript array?
- How can I print using JQuery
- Short circuit Array.forEach like calling break
- TypeError: Router.use() requires middleware function but got a Object
- What is the most efficient way to deep clone an object in JavaScript?
- Loading local JSON file
- MissingSchemaError: Schema hasn’t been registered for model “User”
- classical inheritance vs prototypal inheritance in javascript
- Uncaught TypeError: Cannot read property ‘value’ of null
- How to subtract date/time in JavaScript?
- Full-screen iframe with a height of 100%
- Change CSS of class in Javascript?
- Async/await in componentDidMount to load in correct order
- Dynamically load JS inside JS
- Tainted canvases may not be exported
- Error: Cannot find module html
- Is it possible to append to innerHTML without destroying descendants’ event listeners?
- How to sort an object array by date property?
- React router not showing browser history
- How to define DO NOTHING in JavaScript
- How to get the difference between two arrays in JavaScript?
- What happened to Lodash _.pluck?
- Simplest/cleanest way to implement a singleton in JavaScript
- Extract hostname name from string
- How to connect signalR from angularJs
- How can I copy to clipboard in HTML5 without using flash?
- how to get the value of a textarea in jquery?
- What counts as CPU Intensive tasks (eg. sorting, searching etc?)
- HTML make text clickable without making it a hyperlink
- Uncaught ReferenceError: React is not defined
- How to get the browser viewport dimensions?
- Getting HTML form values
- How to run a function when the page is loaded?
- RegEx: How can I match all numbers greater than 49?
- Multiple left-hand assignment with JavaScript
- Disabled href tag
- How to get child element by class name?
- TypeError getElementsByTagName is not a function issue
- Creating Accordion Table with Bootstrap
- How to fix javascript .toFixed is not a Function error
- jQuery checkbox checked state changed event
- Javascript, viewing [object HTMLInputElement]
- Why onbeforeunload event is not firing
- etect the Enter key in a text input field
- Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (
) - What’s the equivalent of Java’s Thread.sleep() in JavaScript?
- What do the args for Gutenberg subpackage “hooks” function “doAction” mean?
- Include Javascript as Plain (No file inclusion)
- Adding wp_ajax to a theme outside functions.php (on specific template page)
- Insert shortcode in post editor from javascript (Visual / HTML)
- Provide specific example for block variation
- Block editor: How to check if block editor has initialized and populated the data store?
- Contact Form 7 – Give each checkbox a class?
- is_page not working when loading javascript with add_action in functions.php
- Hide reply button after moveForm is called
- Why my javascript code not working for the dashboard of wordpress admin?
- Detect When User Reads Full Article? [closed]
- How to add custom javascript into from custom plugin
- remove inline scripts from the_content() produced by plugins?
- How to set callback to execute after all the tinyMCE editors have been initialized?
- How to add classes and events to image in javascript using Gutenberg?
- Correctly enqueue scripts of type=text/paperscript (PaperJs Library)
- useSelect second parameter
- Adding Code into Theme Customizer Header
- Javascript in wordpress
- How do I make my wordpress post appear in a mouse hover preview?
- Do I just put the html in a page when enqueueng or do I also have to reference js file from the html page [closed]
- How to inherit custom javascript from parent to child pages?
- jQuery UI Tools: Scrollable: More than 1 instance possible?
- imporing HTML+javascript from REST API
- how to add a custom javascript file to our theme
- Why does my array sort order changes when I pass it to JS using WP_REST_Response?
- WordPress Guternberg Content For React Native
- Custom block update rendering when reused
- How do I add my own scripts to the add_action(‘wp_enqueue_scripts’) function?
- Post title and url not showing on google map marker [closed]
- Including js script at end of header
- contact form 7 javascript and wpcf7_before_send_mail action
- Trigger a function during onload
- Embed Kajabi into WP
- Google AdSense Ad not showing up in WordPress Blog [closed]