Comments (13)
#Scope and Closures
#Chapter 3
- Note after reading this far. Even though I have read through 3 chapters it seems like 1 long progressive chapter.
- Since there are a number of browser issues, here is what I am using for these tests:
- Chrome Version 32.0.1700.76 m
- IE Version 10.0.9200.16750
- Hiding in Plain Scope Example #1
- Recommend making the last line something that outputs to the console like previous examples in the book
var result = doSomething(2);
console.log(result); //15
//or
console.log(doSomething(2)); //15
- Recommend making the last line something that outputs to the console like previous examples in the book
- Block Scope Example #1
- Recommend showing console output in comment like previous examples
- Block Scope Example #2
- Recommend having an example that runs and console.log's something
- Let Example #1
- Chrome shows correctly. IE shows significantly different error: Expected ';'
- Let Example #2
- Chrome throws this error: Uncaught SyntaxError: Unexpected identifier
- IE shows this error: Expected ';'
- Let Examples #3 and #4
- I realize they are for example only but most of your examples have been able to be put directly into a test file and run but these cannot. Might want to consider a different example that is able to be executed.
- Let Example #5 (this is even after I commented out the line that is supposed to throw the error)
- Chrome throws this error: Uncaught SyntaxError: Unexpected identifier
- IE shows this error: Expected ';'
- Let Example #6
- Chrome throws this error: Uncaught SyntaxError: Unexpected identifier
- IE shows this error: Expected ';'
- I get the feeling that my browsers dont like "let"
- Let Examples # 7,8,9
- I understand the logic but they are not testable via copy/paste. Consider adding a little more so it is easily testable.
- Const Example
- Seems kind of thrown in at the end of the chapter.
- Multiple issues with this code example.
- Chrome doesnt like foo : Uncaught ReferenceError: foo is not defined
- When I changed foo to true, then it doesnt throw an error but shows 3 3
- IE doesnt like Const, shows: Syntax error
from you-dont-know-js.
FYI: ES6 examples, such as those that use let
or const
, only work in ES6 browsers. IE10 is not ES6 (IE11 has a few ES6 features in it, but I dunno if let
and const
are included). Chrome is only ES6 if you have the "experimental javascript" flag in your settings turned on, AND you have the code running in "strict mode".
from you-dont-know-js.
Gotcha. I forgot to reference your chart (which i now cant find). I will have to rerun them in an ES6 browser to confirm. Thanks!
from you-dont-know-js.
The chart is easy: Chrome+strict mode+"experimental js". And sometimes FF. ;-)
Snark aside: http://kangax.github.io/es5-compat-table/es6/
But that table can be wildly misleading. So use what I said instead. :)
from you-dont-know-js.
#Scope and Closures
#Chapter 4
- Looks good and examples work.
from you-dont-know-js.
#Scope and Closures
#Chapter 3 - Redo using Firefox v26.0 via JSFiddle.com
Note after reading this far. Even though I have read through 3 chapters it seems like 1 long progressive chapter.
Overall I would like to see more executable examples, as some of these are representative but cannot be copy/pasted into the browser to test. Also you mention the ES6 as if it is new and usable but it is most people will not be able to use this for a bit given what I have experienced and what the ES6 compatibility guide says.
- Hiding in Plain Scope Example #1
- Recommend making the last line something that outputs to the console like previous examples in the book var result = doSomething(2); console.log(result); //15 //or console.log(doSomething(2)); //15
- Block Scope Example #1
- Recommend showing console output in comment like previous examples
- Block Scope Example #2
- Recommend having an example that runs and console.log's something
- Let Example #1 and #2
- I get what you're trying to convey but it has a console.log statment but i never gets there to throw an error if trying to execute it.
- Let Examples #3 and #4
- I realize they are for example only but most of your examples have been able to be put directly into a test file and run but these cannot. Might want to consider a different example that is able to be executed.
- Let Example #5 and #6
- Now works for me
- Let Examples # 7,8,9
- I understand the logic but they are not testable via copy/paste. Consider adding a little more so it is easily testable.
- Const Example
- Seems kind of thrown in at the end of the chapter.
- To get it to work I had to change 'foo' to 'true'
- Output was '33', didnt throw an error
from you-dont-know-js.
#Scope and Closures
#Chapter 5
- Browsers Used
- Chrome Version 32.0.1700.76 m
- IE Version 10.0.9200.16750
- Firefox v26.0 via JSFiddle.com
- Nitty Gritty Example #3
- Not sure if it is supposed to show something in the console.log or not but I dont
- Nitty Gritty Example #4
- Not sure what it is supposed to see in the console.log but i only see '2'
- Now I Can See
- Would not use the word 'He' as it does not keep with previous writing style
- Example #2 - not sure what you are trying to show here
- Loops and Closure
- I really like this first set of 3 examples. They all work easily, build up, and payoff nicely.
- Block Scope Revisited Example #1
- I could only test in FF via JSF but it only printed out '1' then the page just kept spinning but nothing happened
- Block Scope Revisited Example #2
- I could only test in FF via JSF but it only printed out '6' then the page just kept spinning but nothing happened
- Modern Modules
- I copied the code from both sections into my example file in order and ran them but only got 'LET ME INTRODUCE: HIPPO' as output
- Future Modules
- I am not sure how to set up and test these examples
from you-dont-know-js.
#Scope and Closures
#Chapter 1 - Reread
- You dive right in with chapter 1. Consider an introduction to the book. Something that will give an overview but also something that you use in each book in the series to differentiate it.
- I like how the 'Scope Conversations' section reads and explains things as well as the 'Conversation?' section.
- Consider giving the answers to the Quiz.
- I also like the TL;DR wrap up section for each chapter.
from you-dont-know-js.
#Scope and Closures
#Chapter 2 - Reread
- Consider adding a graphic to the Lex-time section to show the 3 bubbles in the example
- Recommend adding a little more introductory information for the 'With' section
from you-dont-know-js.
@vball525
Did you see: https://github.com/getify/You-Dont-Know-JS/blob/master/preface.md
That's the "intro" that will appear in each book. Though, based on some feedback, I'm going to be re-working it a bit, toning it down slightly. :)
from you-dont-know-js.
I did not know that preface file was for all books in the series. Reviewing now.
from you-dont-know-js.
#Preface
- I would remove the first paragraph (starting with 'before i begin') about 'JS'. The second paragraph about JS's root is great and should be the opening.
- I am not sure the 3rd paragraph (starting with 'But as a language') is needed. I would consider removing it.
- I recommend rewriting the paragraph that starts with 'But therein lies the paradox'. I get what you are saying but the first few sentences dont flow well.
- Try not to start sentences, especially those that begin paragraphs, with And or But.
from you-dont-know-js.
Thanks for all the great feedback. I've finished posting revisions that take your comments into account.
from you-dont-know-js.
Related Issues (20)
- Yeah but you have the NITDA
- Backward and forward compatibility in Javascript specification HOT 2
- Stale Closure HOT 1
- Get Started - Appendix B: Bug in Proposed Solution HOT 3
- Add simplified Chinese translation to the 2ed HOT 4
- Misspellings detected by `typos` HOT 1
- What's this
- I think the condition in the if statement should be "(new.target === Point2d)" now it is "(new.target === Point2)" HOT 1
- Unable to see images on generated epub HOT 3
- The lexical binding of an arrow-function cannot be overridden (even with `new`!) HOT 4
- Value Type - Primitive HOT 7
- Reordering of "Why Closure?" and "An Alternative Perspective" in the toc HOT 1
- Hint at what coercion is being done HOT 2
- Promise.prototype.finally was introduced in ES2018, not E2019 HOT 1
- IsLessThan wrong output HOT 1
- Does `module` need quotes? HOT 1
- Copy right policy about teaching your book HOT 2
- Superficial explanation of Modules In Chapter 2 of Book 1 (2nd edition) HOT 4
- `add10To` vs `addTo10` HOT 2
- YDKJSY, coercion practice question HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from you-dont-know-js.