Update 04-javascript.md (#1209)

this arrow function uses implicit return. an explicit `return` throws an error.
This commit is contained in:
coldhead 2021-01-22 20:27:59 +11:00 committed by GitHub
parent 13282a7176
commit 7e41ad5f0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -1114,7 +1114,7 @@ element.style.setProperty('--animate-duration', '0.5s');
<p>You can also use a simple function to add the animations classes and remove them automatically:</p>
<pre><code class="language-javascript">const animateCSS = (element, animation, prefix = 'animate__') =&gt;
// We create a Promise and return it
return new Promise((resolve, reject) =&gt; {
new Promise((resolve, reject) =&gt; {
const animationName = `${prefix}${animation}`;
const node = document.querySelector(element);

View file

@ -30,7 +30,7 @@ You can also use a simple function to add the animations classes and remove them
```javascript
const animateCSS = (element, animation, prefix = 'animate__') =>
// We create a Promise and return it
return new Promise((resolve, reject) => {
new Promise((resolve, reject) => {
const animationName = `${prefix}${animation}`;
const node = document.querySelector(element);