My iambic pentameter generator has been one of the most popular posts of the blog. To be honest, I’m not sure if that’s still the case or not. Since I completely revamped the blog (actually even earlier), I removed Google and Jetpack analytics. In any case, today we’ll be looking at, essentially, the reverse scenario: We’re making a very simple iambic pentameter checker.
Just in case you need a reminder, an iambic pentameter line consists of ten syllables, of which every other is stressed. For instance, “And you, my sinews, grow not instant old” (from Hamlet).
So, how can we create a JavaScript iambic pentameter checker that tells us if a line is an iambic pentameter or not?
(more…)