Code Monkey home page Code Monkey logo

js_assignment's Introduction

js_assignment's People

Contributors

brf153 avatar eshaanagg avatar justanaverageguy avatar vaibhav-1508 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

js_assignment's Issues

Facing problems in the question TimespanToHumanString() in the strings.js section

I'm using the following code to determine the return statement :

function getTimePeriod(start, end) {
const startDate = new Date(start);
const endDate = new Date(end);
const diff = (endDate - startDate) / 1000; // difference in seconds

if (diff <= 45) {
return "a few seconds ago";
} else if (diff <= 90) {
return "a minute ago";
} else if (diff <= 45 * 60) {
const minutes = Math.round(diff / 60);
return ${minutes} minutes ago;
} else if (diff <= 90 * 60) {
return "an hour ago";
} else if (diff <= 22 * 60 * 60) {
const hours = Math.round(diff / (60 * 60));
return ${hours} hours ago;
} else if (diff <= 36 * 60 * 60) {
return "a day ago";
} else if (diff <= 25 * 24 * 60 * 60) {
const days = Math.round(diff / (24 * 60 * 60));
return ${days} days ago;
} else if (diff <= 45 * 24 * 60 * 60) {
return "a month ago";
} else if (diff <= 345 * 24 * 60 * 60) {
const months = Math.round(diff / (30 * 24 * 60 * 60));
return ${months} months ago;
} else if (diff <= 545 * 24 * 60 * 60) {
return "a year ago";
} else {
const years = Math.round(diff / (365 * 24 * 60 * 60));
return ${years} years ago;
}
}

However, the code returns wrong answers where ever the code deals with situations like '30.001" seconds or "45.001".

Typo in src/bulb.js

Line 18 of src/bulb.js should read
'Set the "bulb" element's Image src to be the image specified by BULB_OFF_URL' , instead of
'Set the "bulb" element's Image src to be the image specified by BULB_ON_URL'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.