frontend-challenges icon indicating copy to clipboard operation
frontend-challenges copied to clipboard

480 - jQuery.css - javascript

Open jsartisan opened this issue 2 months ago • 0 comments

index.js

/**
 * Simple DOM wrapper with method chaining support.
 * @param {string} selector - CSS selector
 * @returns {object} wrapper with chainable methods
 */
function $(selector) {
  const nodeList = document.querySelectorAll(selector);

  return {
    css (property, value) {
      nodeList.forEach(node => {
        node.style[property] = value;
      })

      return this;
    }
  }
}

export { $ };

jsartisan avatar Sep 27 '25 05:09 jsartisan