Page 8, errata fixed

This commit is contained in:
Karan 2021-12-21 17:13:32 +05:30 committed by GitHub
parent 28cf29e31c
commit 152a602523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

24
errata.md Normal file
View File

@ -0,0 +1,24 @@
# Errata, Corrections and Improvements
----------------------------------------------------
If you find any mistakes in the second edition of JavaScript from Beginner to Professional, or if you have suggestions for improvements, then please [raise an issue in this repository](https://github.com/PacktPublishing/JavaScript-from-Beginner-to-Professional/issues), or email to us.
## Page 8 - Fixing the equals syntax in an `if` statement
The example of an `if` statement here explains how a single `=` sign is always true. It should be `if(hobby = "coding")`
Incorrect code is:
```
if(hobby == "coding"){
console.log("** I love coding too! **");
} else {
console.log("** Can you teach me that? **");
}
```
Correct code is:
```
if(hobby = "coding"){
console.log("** I love coding too! **");
} else {
console.log("** Can you teach me that? **");
}
```