Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
Javascript: what does brackets mean for object key? What does the Object.up() method do?

I came across with this code snippet:

const breakpoints = {
  values: {
    xs: 0,
    sm: 576,
    md: 768,
    lg: 992,
    xl: 1200,
    xxl: 1400,
  },
};

  const drawerOpenStyles = () => ({
    background: backgroundValue,
    transform: "translateX(0)",
    transition: transitions.create("transform", {
      easing: transitions.easing.sharp,
      duration: transitions.duration.shorter,
    }),

    [breakpoints.up("xl")]: {  // what does [] mean? what does .up() do? 
      boxShadow: transparentSidenav ? "none" : xxl,
      marginBottom: transparentSidenav ? 0 : "inherit",
      left: "0",
      width: sidebarWidth,
      transform: "translateX(0)",
      transition: transitions.create(["width", "background-color"], {
        easing: transitions.easing.sharp,
        duration: transitions.duration.enteringScreen,
      }),
    },
  });

On the line [breakpoints.up("xl")]: {}, I am having trouble understanding:

  1. What does [] do when it wraps an object key?

  2. What does Object.up() do in javascript?

I was able to print by console.log(drawerOpenStyles: ${JSON.stringify( drawerOpenStyles() )}); and I got this result:


{
   "background":"linear-gradient(195deg, #42424a, #191919)",
   "transform":"translateX(0)",
   "transition":"transform 200ms cubic-bezier(0.4, 0, 0.6, 1) 0ms",
   "@media (min-width:1200px)":{
      "boxShadow":" 0rem 1.25rem 1.6875rem 0rem rgba(0, 0, 0, 0.05)",
      "marginBottom":"inherit",
      "left":"0",
      "width":250,
      "transform":"translateX(0)",
      "transition":"width 225ms cubic-bezier(0.4, 0, 0.6, 1) 0ms,background-color 225ms cubic-bezier(0.4, 0, 0.6, 1) 0ms"
   }
}


How exactly does [breakpoints.up("xl")] give "@media (min-width:1200px)"?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  • The square brackets [] allows you to put an expression in , that will be computed and used as the property name.
  • There is no Object.up() in the Standard Object API in JS. I think breakpoints.up("xl") is related to Material ui breakpoints check https://mui.com/customization/breakpoints/
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!