Title: Javascript course - Word Analytics word count bug · Issue #11 · ByteGrad/Professional-JavaScript-Course · GitHub
Open Graph Title: Javascript course - Word Analytics word count bug · Issue #11 · ByteGrad/Professional-JavaScript-Course
X Title: Javascript course - Word Analytics word count bug · Issue #11 · ByteGrad/Professional-JavaScript-Course
Description: This might be a somewhat pedantic issue, but working through the javascript course, I wrote my own code first, then comparedd it to yours and found a couple of pretty obvious bugs with the word count feature. As someone who has bought al...
Open Graph Description: This might be a somewhat pedantic issue, but working through the javascript course, I wrote my own code first, then comparedd it to yours and found a couple of pretty obvious bugs with the word cou...
X Description: This might be a somewhat pedantic issue, but working through the javascript course, I wrote my own code first, then comparedd it to yours and found a couple of pretty obvious bugs with the word cou...
Opengraph URL: https://github.com/ByteGrad/Professional-JavaScript-Course/issues/11
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Javascript course - Word Analytics word count bug","articleBody":"This might be a somewhat pedantic issue, but working through the javascript course, I wrote my own code first, then comparedd it to yours and found a couple of pretty obvious bugs with the word count feature.\r\n\r\nAs someone who has bought all your courses, let me say in advance that I really enjoy your lecture style and command of the material, so this is really just something for those who are trying to dig beneath the surface level of the projects, or trying out variations using their own code.\r\n\r\nSince the word count splits on a space constant, the number of words will be off if:\r\n\r\n- any whitespace is added, so in your video even though you have 4 words, the word count is 5 as you type once you add an extra space.\r\n- adding some whitespace before or after throws off the word count and the check for an empty entry\r\n- with the space constant ' ', split doesn't understand other whitespace characters like newlines and tabs\r\n\r\nThis can of course be fixed fairly easily with some simple regex and slight variation to your code (my variable names might be different from yours):\r\n\r\n`const numwordsEl = document.querySelector(\".stat__number--words\");`\r\n\r\nIn the input handler function...\r\n\r\n if (textareaEl.value.trim().length \u003e 0) {\r\n const strWords = textareaEl.value.trim().split(/\\s+/).length;\r\n numwordsEl.textContent = strWords;\r\n } else {\r\n numwordsEl.textContent = 0;\r\n }","author":{"url":"https://github.com/gizmola","@type":"Person","name":"gizmola"},"datePublished":"2024-11-05T05:35:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/11/Professional-JavaScript-Course/issues/11"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ecf3a6b0-0537-2d5c-b94d-791e71c6cc5f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DC5A:111866:D1DBC5:114161B:6A51930D |
| html-safe-nonce | 3d64689ec83efdb8b75a303a405d3e85560e4ecaeced5534739e07bd063ff52a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzVBOjExMTg2NjpEMURCQzU6MTE0MTYxQjo2QTUxOTMwRCIsInZpc2l0b3JfaWQiOiIxMDYwMjg3MDU5MDQ0OTYzMDg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4cfcb1b801ba17d48ca2d5bff95e1ed711e056e8ce4e467ef4536280d6674fbf |
| hovercard-subject-tag | issue:2634469031 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ByteGrad/Professional-JavaScript-Course/11/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d4ec9e0eb3e675f88f58f39f96cbb4307ed53d24bbbb7fecb7c7ad5c10a3cc45/ByteGrad/Professional-JavaScript-Course/issues/11 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d4ec9e0eb3e675f88f58f39f96cbb4307ed53d24bbbb7fecb7c7ad5c10a3cc45/ByteGrad/Professional-JavaScript-Course/issues/11 |
| og:image:alt | This might be a somewhat pedantic issue, but working through the javascript course, I wrote my own code first, then comparedd it to yours and found a couple of pretty obvious bugs with the word cou... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gizmola |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/ByteGrad/Professional-JavaScript-Course git https://github.com/ByteGrad/Professional-JavaScript-Course.git |
| octolytics-dimension-user_id | 82057865 |
| octolytics-dimension-user_login | ByteGrad |
| octolytics-dimension-repository_id | 480343983 |
| octolytics-dimension-repository_nwo | ByteGrad/Professional-JavaScript-Course |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 480343983 |
| octolytics-dimension-repository_network_root_nwo | ByteGrad/Professional-JavaScript-Course |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width