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


JavaScript လုပ်ဆောင်ချက်

ဥပမာ

၎င်းကိုခေါ်သောအခါ "Hello World" ကိုထုတ်ပေးသည့်လုပ်ဆောင်ချက်ကိုကြေငြာပါ-

// Declare a function
function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World!";
}

// Call the function
myFunction();

အောက်တွင် နောက်ထပ် ဥပမာများ။


အဓိပ္ပါယ်နှင့် အသုံးပြုမှု

functionကြေငြာချက်သည် function ကိုကြေငြာသည်

ကြေညာထားသည့် လုပ်ဆောင်ချက်ကို "နောက်ပိုင်းအသုံးပြုရန်အတွက် သိမ်းဆည်းထားသည်" ဖြစ်ကာ ၎င်းကို ခေါ်ဆိုသည့်အခါ (ခေါ်သည်) နောက်ပိုင်းတွင် လုပ်ဆောင်မည်ဖြစ်သည်။

JavaScript တွင် လုပ်ဆောင်ချက်များသည် အရာဝတ္ထုများဖြစ်ပြီး ၎င်းတို့တွင် ဂုဏ်သတ္တိနှင့် နည်းလမ်းများ နှစ်မျိုးလုံးရှိသည်။

လုပ်ဆောင်ချက်တစ်ခုကို စကားရပ်တစ်ခုဖြင့်လည်း သတ်မှတ်နိုင်သည် ( Function Definitions ကိုကြည့်ပါ )။

လုပ်ဆောင်ချက်များအကြောင်း သိလိုသမျှကို လေ့လာရန် ကျွန်ုပ်တို့၏ JavaScript ကျူတိုရီရယ်ကို ဖတ်ရှုပါ။ JavaScript Functions နှင့် JavaScript Scope အကြောင်း နိဒါန်းအခန်းတွင် စတင်ပါ ပိုမိုအသေးစိတ်အချက်အလက်အတွက်၊ Function အဓိပ္ပါယ်ဖွင့ ်ဆို ချက်များ၊ ကန့်သတ် ချက်များ ၊ တောင်းခံခြင်း နှင့် ပိတ်ခြင်း များဆိုင်ရာ ကျွန်ုပ်တို့၏ Function အပိုင်းကို ကြည့်ပါ ။

ကိုလည်းကြည့်ပါ-

ပြန်ကြေငြာချက်


အထားအသို

function functionName(parameters) {
  code to be executed
}

ကန့်သတ်ချက်များ

Parameter Description
functionName Required.
The name of the function.
Naming rules: same as JavaScript variables.
parameters Optional.
A set of arguments (parameter names), separated by commas.

The arguments are real values received by the function from the outside.
Inside the function, the arguments are used as local variables.

If a function is called with a missing argument, the value of the missing argument is set to undefined.


နောက်ထပ် ဥပမာများ

PI ၏တန်ဖိုးကို ပြန်ပေးသည်-

function myFunction() {
  return Math.PI;
}

a နှင့် b ၏ ထုတ်ကုန်ကို ပြန်ပေးပါ-

function myFunction(a, b) {
  return a * b;
}

မတူညီသော အကြောင်းပြချက်များဖြင့် လုပ်ဆောင်မှုတစ်ခုသည် မတူညီသောရလဒ်များကို ထုတ်ပေးနိုင်သည်။

ဖာရင်ဟိုက်ကို စင်တီဂရိတ်သို့ ပြောင်းပါ-

function toCelsius(fahrenheit) {
  return (5/9) * (fahrenheit-32);
}

လုပ်ဆောင်ချက်များကို ကိန်းရှင်များအဖြစ် အသုံးပြုနိုင်သည်။

အစား:

temp = toCelsius(32);
text = "The temperature is " + temp + " Centigrade";

သင်အသုံးပြုနိုင်သည်-

text = "The temperature is " + toCelsius(32) + " Centigrade";

JavaScript လုပ်ဆောင်ချက်များတွင် arguments ဟုခေါ်သော built-in object တစ်ခုရှိသည်။

arguments.length ပိုင်ဆိုင်မှုသည် function မှရရှိသော argument အရေအတွက်ကို ပြန်ပေးသည်-

function myFunction(a, b) {
  return arguments.length;
}

"Hello World" ဟူသော လုပ်ဆောင်ချက်ကို ခေါ်ဆိုရန် နှိပ်ပါ။

<button onclick="myFunction()">Click me</button>

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
</script>

function expression တစ်ခုကို variable တွင် သိမ်းဆည်းသောအခါ၊ variable တွင် function တစ်ခုပါရှိသည်-

const x = function (a, b) {return a * b};

လုပ်ဆောင်ချက်တစ်ခုကို variable တစ်ခုတွင် သိမ်းဆည်းသောအခါ၊ variable ကို function တစ်ခုအဖြစ်အသုံးပြုနိုင်သည်-

const x = function (a, b) {return a * b};
let z = x(4, 3);

ဆက်စပ်စာမျက်နှာများ

JavaScript သင်ခန်းစာ- JavaScript လုပ်ဆောင်ချက်များ

JavaScript သင်ခန်းစာ- JavaScript နယ်ပယ်

JavaScript ကျူတိုရီရယ်- JavaScript လုပ်ဆောင်ချက် အဓိပ္ပါယ်ဖွင့်ဆိုချက်

JavaScript သင်ခန်းစာ- JavaScript လုပ်ဆောင်ချက် ကန့်သတ်ချက်များ

JavaScript ကျူတိုရီရယ်- JavaScript လုပ်ဆောင်ချက် ခေါ်ဆိုမှု

JavaScript ကျူတိုရီရယ်- JavaScript လုပ်ဆောင်ချက် ပိတ်သည် ။

JavaScript ရည်ညွှန်းချက်- JavaScript ပြန်ဖော်ပြချက်


Browser ပံ့ပိုးမှု

function ECMAScript1 (ES1) အင်္ဂါရပ်တစ်ခုဖြစ်သည်။

ES1 (JavaScript 1997) ကို ဘရောက်ဆာအားလုံးတွင် အပြည့်အဝ ပံ့ပိုးထားသည်။

Chrome IE Edge Firefox Safari Opera
Yes Yes Yes Yes Yes Yes