Skip to content

Instantly share code, notes, and snippets.

@jedsada-gh
Created February 6, 2022 07:42
Show Gist options
  • Save jedsada-gh/8a161a43992f9c1ee4df67212f7678af to your computer and use it in GitHub Desktop.
Save jedsada-gh/8a161a43992f9c1ee4df67212f7678af to your computer and use it in GitHub Desktop.
import axios from "axios";
(async () => {
const req = axios.create({ baseURL: "https://jsonplaceholder.typicode.com" });
const json = (await req.get("/todos")).data
const newItems = []
for(let i = 0; i < json.length; i++) {
if (json[i].completed === false) {
newItems.push(json[i])
}
}
console.log("newItems: ", json.length - newItems.length)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment