FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Easy

jQuery CSS

10mins

Implement a function css(element, property, value) that sets the style of a DOM element.

The function should:

  • Accept a DOM element element.
  • Accept a CSS property property as a string.
  • Accept a value value as a string or number.
  • Apply the style to the element.

Examples

const div = document.createElement('div'); css(div, 'color', 'red'); console.log(div.style.color); // 'red' css(div, 'width', '100px'); console.log(div.style.width); // '100px'

Code Editor

JavaScript Function

00:00
Loading...

Test Cases

No test results yet

Click "Run" to execute tests