Skip to content

Article reading time calculation with javascript

Notifications You must be signed in to change notification settings

snrylmz/reading-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Reading Time

Article reading time calculation with jquery

Description

Based on an article at medium.com, I created a simple formula such as reading time (in seconds) / number of words, and according to the result, the reading time of a word is 0.2857563851 seconds.

#readed-words to find the number of words by finding the gaps.

The total number of words * The word reading time gives us the result in seconds, by making an account. Then we turn it into minutes by making / 60.


$(function() {
    var text = $('#readed-words').text();
    var wordsCount = text.split(' ').length;
    var wordTime = 0.2857563851;
    var readingTime = Math.round(wordTime * wordsCount / 60);
      $('#output').html('Number of words : ' + wordsCount + '</br> Reading Time: ☕️' + readingTime + ' Minutes reading time');
  });

It works even if it's not very strong.

----sorry for the translation.

Getting Started

To begin using this template, choose one of the following options to get started:

  • Clone the repo: git clone https://github.com/snrylmz/reading-time.git

Creator

Reading Time was created by and is maintained by Şener YILMAZ

Copyright and License

Code released under the [MIT] license.

About

Article reading time calculation with javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages