Many browsers implement a public subset of JavaScript, making most of the Code compatible with different browsers. The incompatibility problem is not the language itself, instead, the underlying Document Object Model (DOM) opened by the browser is different. For example, an object in JavaScript can be Date or String. Whether implemented in safari or navigator, it can be Date or String. In the implementation of JavaScript by different browsers, opening and operating these DOM objects leads to incompatibility between browsers.
In addition, we know that JavaScript can modify the attributes of elements, which can be defined by css style attributes. However, the implementation of css in browsers may be different, leading to cross-browser incompatibility issues.
-- Extracted from the core JavaScript technology (Sbelley Powers, o'reilly)