JS Reference

JS by Category JS by Alphabet

JavaScript

JS Array JS Boolean JS Classes JS Date JS Error JS Global JS JSON JS Math JS Number JS Operators JS RegExp JS Statements JS String

Window

Window Object Window Console Window History Window Location Window Navigator Window Screen

HTML DOM

DOM Document DOM Element DOM Attributes DOM Events DOM Event Objects DOM HTMLCollection DOM Style
alignContent alignItems alignSelf animation animationDelay animationDirection animationDuration animationFillMode animationIterationCount animationName animationTimingFunction animationPlayState background backgroundAttachment backgroundColor backgroundImage backgroundPosition backgroundRepeat backgroundClip backgroundOrigin backgroundSize backfaceVisibility border borderBottom borderBottomColor borderBottomLeftRadius borderBottomRightRadius borderBottomStyle borderBottomWidth borderCollapse borderColor borderImage borderImageOutset borderImageRepeat borderImageSlice borderImageSource borderImageWidth borderLeft borderLeftColor borderLeftStyle borderLeftWidth borderRadius borderRight borderRightColor borderRightStyle borderRightWidth borderSpacing borderStyle borderTop borderTopColor borderTopLeftRadius borderTopRightRadius borderTopStyle borderTopWidth borderWidth bottom boxShadow boxSizing captionSide caretColor clear clip color columnCount columnFill columnGap columnRule columnRuleColor columnRuleStyle columnRuleWidth columns columnSpan columnWidth counterIncrement counterReset cursor direction display emptyCells filter flex flexBasis flexDirection flexFlow flexGrow flexShrink flexWrap cssFloat font fontFamily fontSize fontStyle fontVariant fontWeight fontSizeAdjust height isolation justifyContent left letterSpacing lineHeight listStyle listStyleImage listStylePosition listStyleType margin marginBottom marginLeft marginRight marginTop maxHeight maxWidth minHeight minWidth objectFit objectPosition opacity order orphans outline outlineColor outlineOffset outlineStyle outlineWidth overflow overflowX overflowY padding paddingBottom paddingLeft paddingRight paddingTop pageBreakAfter pageBreakBefore pageBreakInside perspective perspectiveOrigin position quotes resize right scrollBehavior tableLayout tabSize textAlign textAlignLast textDecoration textDecorationColor textDecorationLine textDecorationStyle textIndent textOverflow textShadow textTransform top transform transformOrigin transformStyle transition transitionProperty transitionDuration transitionTimingFunction transitionDelay unicodeBidi userSelect verticalAlign visibility width wordBreak wordSpacing wordWrap widows zIndex

Web APIs

API Console API Fullscreen API Geolocation API History API MediaQueryList API Storage

HTML Objects

<a> <abbr> <address> <area> <article> <aside> <audio> <b> <base> <bdo> <blockquote> <body> <br> <button> <canvas> <caption> <cite> <code> <col> <colgroup> <datalist> <dd> <del> <details> <dfn> <dialog> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <footer> <form> <head> <header> <h1> - <h6> <hr> <html> <i> <iframe> <img> <ins> <input> button <input> checkbox <input> color <input> date <input> datetime <input> datetime-local <input> email <input> file <input> hidden <input> image <input> month <input> number <input> password <input> radio <input> range <input> reset <input> search <input> submit <input> text <input> time <input> url <input> week <kbd> <label> <legend> <li> <link> <map> <mark> <menu> <menuitem> <meta> <meter> <nav> <object> <ol> <optgroup> <option> <output> <p> <param> <pre> <progress> <q> <s> <samp> <script> <section> <select> <small> <source> <span> <strong> <style> <sub> <summary> <sup> <table> <tbody> <td> <tfoot> <th> <thead> <tr> <textarea> <time> <title> <track> <u> <ul> <var> <video>

Other References

CSSStyleDeclaration JS Conversion


जावास्क्रिप्ट ऑपरेटर संदर्भ


जावास्क्रिप्ट ऑपरेटरों का उपयोग मूल्यों को निर्दिष्ट करने, मूल्यों की तुलना करने, अंकगणितीय संचालन करने और बहुत कुछ करने के लिए किया जाता है।


जावास्क्रिप्ट अंकगणित ऑपरेटर

अंकगणितीय ऑपरेटरों का उपयोग चर और/या मानों के बीच अंकगणित करने के लिए किया जाता है।

यह देखते हुए कि y = 5 , नीचे दी गई तालिका अंकगणितीय ऑपरेटरों की व्याख्या करती है:

Operator Description Example Result in y Result in x Try it
+ Addition x = y + 2 y = 5 x = 7
- Subtraction x = y - 2 y = 5 x = 3
* Multiplication x = y * 2 y = 5 x = 10
/ Division x = y / 2 y = 5 x = 2.5
% Modulus (division remainder) x = y % 2 y = 5 x = 1
++ Increment x = ++y y = 6 x = 6
x = y++ y = 6 x = 5
-- Decrement x = --y y = 4 x = 4
x = y-- y = 4 x = 5

अंकगणितीय ऑपरेटरों के बारे में एक ट्यूटोरियल के लिए, हमारा जावास्क्रिप्ट अंकगणित ट्यूटोरियल पढ़ें ।


जावास्क्रिप्ट असाइनमेंट ऑपरेटर्स

असाइनमेंट ऑपरेटरों का उपयोग जावास्क्रिप्ट चरों को मान निर्दिष्ट करने के लिए किया जाता है।

यह देखते हुए कि x = 10 और y = 5 , नीचे दी गई तालिका असाइनमेंट ऑपरेटरों की व्याख्या करती है:

Operator Example Same As Result in x Try it
= x = y x = y x = 5
+= x += y x = x + y x = 15
-= x -= y x = x - y x = 5
*= x *= y x = x * y x = 50
/= x /= y x = x / y x = 2
%= x %= y x = x % y x = 0

असाइनमेंट ऑपरेटरों के बारे में एक ट्यूटोरियल के लिए, हमारा जावास्क्रिप्ट असाइनमेंट ट्यूटोरियल पढ़ें ।



जावास्क्रिप्ट स्ट्रिंग ऑपरेटर्स

+ ऑपरेटर, और += ऑपरेटर का उपयोग स्ट्रिंग्स को जोड़ने (जोड़ने) के लिए भी किया जा सकता है।

यह देखते हुए कि text1 = "Good" , text2 = "Morning" , और text3 = "" नीचे दी गई तालिका ऑपरेटरों की व्याख्या करती है:

Operator Example text1 text2 text3 Try it
+ text3 = text1 + text2 "Good " "Morning"  "Good Morning"
+= text1 += text2 "Good Morning" "Morning" ""

तुलना ऑपरेटर

तुलना ऑपरेटरों का उपयोग तार्किक बयानों में चर या मूल्यों के बीच समानता या अंतर को निर्धारित करने के लिए किया जाता है।

यह देखते हुए कि x = 5 , नीचे दी गई तालिका तुलना ऑपरेटरों की व्याख्या करती है:

Operator Description Comparing Returns Try it
== equal to x == 8 false
x == 5 true
=== equal value and equal type x === "5" false
x === 5 true
!= not equal x != 8 true
!== not equal value or not equal type x !== "5" true
x !== 5 false
> greater than x > 8 false
< less than x < 8 true
>= greater than or equal to x >= 8 false
<= less than or equal to x <= 8 true

तुलना ऑपरेटरों के बारे में एक ट्यूटोरियल के लिए, हमारा जावास्क्रिप्ट तुलना ट्यूटोरियल पढ़ें ।


सशर्त (टर्नरी) ऑपरेटर

सशर्त ऑपरेटर एक शर्त के आधार पर एक चर के लिए एक मान निर्दिष्ट करता है।

Syntax Example Try it
variablename = (condition) ? value1:value2 voteable = (age < 18) ? "Too young":"Old enough";

उदाहरण समझाया गया: यदि चर "आयु" का मान 18 से कम है, तो "मतदान योग्य" चर का मान "बहुत छोटा" होगा, अन्यथा मतदान योग्य का मान "काफी पुराना" होगा।


लॉजिकल ऑपरेटर्स

तार्किक ऑपरेटरों का उपयोग चर या मूल्यों के बीच तर्क को निर्धारित करने के लिए किया जाता है।

यह देखते हुए कि x = 6 और y = 3 , नीचे दी गई तालिका तार्किक ऑपरेटरों की व्याख्या करती है:

Operator Description Example Try it
&& and (x < 10 && y > 1) is true
|| or (x === 5 || y === 5) is false
! not !(x === y) is true

जावास्क्रिप्ट बिटवाइज़ ऑपरेटर्स

बिट ऑपरेटर 32 बिट नंबर पर काम करते हैं। ऑपरेशन में कोई भी संख्यात्मक ऑपरेंड 32 बिट संख्या में परिवर्तित हो जाता है। परिणाम वापस एक जावास्क्रिप्ट संख्या में परिवर्तित हो जाता है।

Operator Description Example Same as Result Decimal
& AND x = 5 & 1 0101 & 0001 0001  1
| OR x = 5 | 1 0101 | 0001 0101  5
~ NOT x = ~ 5  ~0101 1010  10
^ XOR x = 5 ^ 1 0101 ^ 0001 0100  4
<< Left shift x = 5 << 1 0101 << 1 1010  10
>> Right shift x = 5 >> 1 0101 >> 1 0010   2

ऊपर दिए गए उदाहरण 4 बिट अहस्ताक्षरित उदाहरणों का उपयोग करते हैं। लेकिन जावास्क्रिप्ट 32-बिट हस्ताक्षरित संख्याओं का उपयोग करता है।

इस वजह से, जावास्क्रिप्ट में, ~ 5 10 वापस नहीं आएगा। यह -6 वापस आ जाएगा।

~000000000000000000000000000001 वापस आ जाएगा 11111111111111111111111111111010


टाइपऑफ़ ऑपरेटर

टाइपोफ़ ऑपरेटर एक चर, वस्तु, कार्य या अभिव्यक्ति का प्रकार देता है :

उदाहरण

typeof "John"                 // Returns string
typeof 3.14                   // Returns number
typeof NaN                    // Returns number
typeof false                  // Returns boolean
typeof [1, 2, 3, 4]           // Returns object
typeof {name:'John', age:34}  // Returns object
typeof new Date()             // Returns object
typeof function () {}         // Returns function
typeof myCar                  // Returns undefined (if myCar is not declared)
typeof null                   // Returns object

कृपया ध्यान दें:

  • NaN का डेटा प्रकार संख्या है
  • किसी सरणी का डेटा प्रकार वस्तु है
  • दिनांक का डेटा प्रकार वस्तु है
  • नल का डेटा प्रकार वस्तु है
  • एक अपरिभाषित चर का डेटा प्रकार अपरिभाषित है

जावास्क्रिप्ट ऑब्जेक्ट एक सरणी (या दिनांक) है या नहीं, यह परिभाषित करने के लिए आप टाइपऑफ़ का उपयोग नहीं कर सकते ।


डिलीट ऑपरेटर

डिलीट ऑपरेटर किसी ऑब्जेक्ट से किसी प्रॉपर्टी को हटाता है :

उदाहरण

const person = {
  firstName:"John",
  lastName:"Doe",
  age:50,
  eyeColor:"blue"
};
delete person.age;   // or delete person["age"];

डिलीट ऑपरेटर संपत्ति के मूल्य और संपत्ति दोनों को ही हटा देता है।

हटाने के बाद, संपत्ति को फिर से जोड़ने से पहले उसका उपयोग नहीं किया जा सकता है।

डिलीट ऑपरेटर को ऑब्जेक्ट गुणों पर उपयोग करने के लिए डिज़ाइन किया गया है। इसका चर या कार्यों पर कोई प्रभाव नहीं पड़ता है।

नोट: डिलीट ऑपरेटर का उपयोग पूर्वनिर्धारित जावास्क्रिप्ट ऑब्जेक्ट गुणों पर नहीं किया जाना चाहिए। यह आपके एप्लिकेशन को क्रैश कर सकता है।


ऑपरेटर में

यदि निर्दिष्ट संपत्ति निर्दिष्ट वस्तु में है, तो ऑपरेटर सही लौटाता है, अन्यथा गलत :

उदाहरण

// Arrays
const cars = ["Saab", "Volvo", "BMW"];
"Saab" in cars          // Returns false (specify the index number instead of value)
0 in cars               // Returns true
1 in cars               // Returns true
4 in cars               // Returns false (does not exist)
"length" in cars        // Returns true  (length is an Array property)

// Objects
const person = {firstName:"John", lastName:"Doe", age:50};
"firstName" in person   // Returns true
"age" in person         // Returns true

// Predefined objects
"PI" in Math            // Returns true
"NaN" in Number         // Returns true
"length" in String      // Returns true

ऑपरेटर का उदाहरण

यदि निर्दिष्ट वस्तु निर्दिष्ट वस्तु का एक उदाहरण है, तो इंस्टोफ ऑपरेटर सही है :

उदाहरण

const cars = ["Saab", "Volvo", "BMW"];

(cars instanceof Array)   // Returns true
(cars instanceof Object)  // Returns true
(cars instanceof String)  // Returns false
(cars instanceof Number)  // Returns false

शून्य ऑपरेटर

शून्य ऑपरेटर एक अभिव्यक्ति का मूल्यांकन करता है और अपरिभाषित देता है । इस ऑपरेटर का उपयोग अक्सर "शून्य (0)" (वापसी मूल्य का उपयोग किए बिना अभिव्यक्ति का मूल्यांकन करते समय उपयोगी) का उपयोग करके अपरिभाषित आदिम मूल्य प्राप्त करने के लिए किया जाता है।

उदाहरण

<a href="#;">
  Useless link
</a>

<a href="javascript:void(document.body.style.backgroundColor='red');">
  Click me to change the background color of body to red
</a>