I am trying to print an number in JavaScript with commas as separators. but when i add comma it will give me Nan value For example, I want to show the number 170607 as "170,607". How would I go about doing this?
HTML :
- <div class="row about-stats stats block-1-4 block-m-1-2 block-mob-full" data-aos="fade-up">
- <div class="col-block stats__col ">
- <div class="stats__count">4div>
- div>
- <div class="col-block stats__col">
- <div class="stats__count">40div>
- div>
- <div class="col-block stats__col">
- <div class="stats__count">170607div>
- div>
- <div class="col-block stats__col">
- <div class="stats__count">3447div>
- div>
- div>
- /* Stat Counter
- * ------------------------------------------------------ */
- var clStatCount = function() {
- var statSection = $(".about-stats"),
- stats = $(".stats__count");
- statSection.waypoint({
- handler: function(direction) {
- if (direction === "down") {
- stats.each(function () {
- var $this = $(this);
- $({ Counter: 0 }).animate({ Counter: $this.text() }, {
- duration: 4000,
- easing: 'swing',
- step: function (curValue) {
- $this.text(Math.ceil(curValue));
- }
- });
- });
- }
- // trigger once only
- this.destroy();
- },
- offset: "90%"
- });
- };
Man DownPosted Feb 6, 2018, 5:33 AM
Man DownPosted Feb 6, 2018, 5:06 AM
Altaf AnsariPosted Feb 6, 2018, 4:56 AM
Man DownPosted Feb 6, 2018, 4:56 AM
Man DownPosted Feb 6, 2018, 4:49 AM
Altaf AnsariPosted Feb 6, 2018, 4:43 AM
Man DownPosted Feb 6, 2018, 4:36 AM
Altaf AnsariPosted Feb 6, 2018, 4:29 AM