Skip to content

JavaScriptADI/assignment-products-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Homework5

კომენტარის სახით ახსენით თითოეული ხაზი რას აკეთებს.

შემდეგ შეასრულეთ მოცემული ამოცანები:

  1. count average price
  2. count average words per description
  3. count average characters per description
  4. count maximum words in descriptions
  5. count minimum price in descriptions

(მოგიწევთ გაარკვიოთ რა არის object-ი)

const PRODUCT_COUNT = 50;

const products = [];

// Generate Products

function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min
}

function getRandomString(length) {
    let text = '';
    for (let i = 0; i < length; i++) {
        if (getRandomInt(0, 100) > 10)
            text += String.fromCharCode(getRandomInt(97, 122));
        else
            text += ' ';
    }
    return text;
}

for (let i = 0; i < PRODUCT_COUNT; i++)
    products.push({
        title: getRandomString(getRandomInt(30, 60)),
        price: getRandomInt(500, 5000),
        description: getRandomString(getRandomInt(300, 1000))
    })

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published