Git Product home page Git Product logo

xero-frontend-dev-test's Introduction

CSS/HTML Questions

1. Give a brief description of the box model

The box-model is essentially the rendering "rules" for an html element. These rules dictate how elements use space within the viewport.

2. What is the difference between display: inline; and display: block?

Standard block level elements are 100% width of their parent (unless they float, or flex..), and they can recieve padding and margin, whereas an inline element is only the width of it's content, and certain padding and margin properties will have no effect.

3. How is the z-index property used and why?

z-index controls stack order and is often used for modals/dialogs, slide-out or off canvas menus, and anything that needs to overlap another element. A SCSS arcitecture benefits greatly from having all z-index declarations in a single file and spread out using variables, this allows a nice overview of which elements are stacked with z-index.

4. Can you give an example of when you would use absolute positioning?

Absolute positioning should be used sparingly as it breaks the box-model to an extent, which is generally not favourable because it means the element won't generally flow with the content which doesn't scale very well in responsive layouts. An obvious example of when to use absolute positioning is for a modal window. Other uses might be a tooltip pop-up or a menu dropdown.

Javascript Questions

Const sales = [
    { itemSold: “Football”, price: 19.99, dateSold: ‘2018-04-07’, id: ‘j_123 },
    { itemSold: “Trainers”, price: 159.95, dateSold: ‘2018-03-02’, id: ‘t_acds1’ },
    { itemSold: “Cricket bat”, price: 204.97, dateSold: ‘2018-04-05’ id: ‘j_456’},
    { itemSold: ”Rugby ball”, price: 30.00, dateSold: ‘2017-04-22’, id: ‘t_acds3’ },
    { itemSold: “Hockey stick”, price: 54.95, dateSold: ‘2017-03-19’, id: ‘j_999’ }
]

1. Write a function to return the sum of the price of all properties as a single value.

function() {
    return sales
        .map(x => x.price)
        .reduce( (acc, current) => acc + current, 0 );
}

2. Write a function to only return the items which were sold in 2017.

function() {
    const minDate = new Date("2017", "01", "01").getTime();
    const maxDate = new Date("2017", "12", "31").getTime();
    
    return sales.filter(x => {
        const date = new Date(x.dateSold).getTime();
        
        if(date > minDate && date < maxDate) {
            return true;
        }
    });
}

3. Write a function to return an array of all of the itemsSold properties as strings, sorted alphabetically.

function() {
    return sales.map(x => x.itemSold).sort();
}

4. Write a function which takes an id as an argument and returns the sale which matches the id.

function(id) {
    return sales.filter(x => x.id == id);
}

xero-frontend-dev-test's People

Contributors

tjmedcalf avatar

Watchers

 avatar

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.