Skip to main content

Posts

Showing posts from April, 2024

HackerRank JavaScript Certification Intermediate Solutions

 'use strict'; const fs = require('fs'); const https = require('https'); process.stdin.resume(); process.stdin.setEncoding('utf-8'); let inputString = ''; let currentLine = 0; process.stdin.on('data', function(inputStdin) {       inputString += inputStdin; }); process.stdin.on('end', function() {     inputString = inputString.split('\n');     main(); }); function readLine() {       return inputString[currentLine++]; } const axios =  require('axios'); async function getNumTransactions(username) {     // write your code here     // API endpoint: https://jsonmock.hackerrank.com/api/article_users?username=<username>     // API endpoint: https://jsonmock.hackerrank.com/api/transactions?&userId=<userId>     try {         const {data} = await axios.get(`https://jsonmock.hackerrank.com/api/article_users?username=${username}`);         if(dat...

Hackerrank JavaScript Certification Intermediate Solutions

 HackerRank JavaScript Intermediate Text Certification Solution class Image {     // Add methods here     url;     height;     width;     constructor(url, size){         this.url = url;         this.height = size.height;         this.width = size.width         console.log(size)     }     getUrl(){         return this.url;     }     setUrl(url){         this.url =  url;     }     setSize(width,height) {         this.width = width;         this.height = height;     }     getSize(){         return new Size(this.width, this.height)     }     cloneImage(){         return new Image(this.url, new Size(this.width, this.height))    ...