Operators Precedence 

Maxa laga wadaa Operators Precedence ? micnaha oo kooban waxa weeyo mudnaanta lakala siinayo operators ka. Waxa jiro shirci guud oo la isticmaalo marki aad isku dhex qorto xisaabaad badan oo kala duwan.

Tusaale

2 * 2 - (2 + 1) / 3

Xisaabtan kore qaacidada ey javaScript u isticmaaleyso waxa lo yaqaanaa BODMAS, Brackets Order Division Multiplication Addition Subtraction. Marka hore waxa la xalinaya inta bracket ka [ ] ku jirto, kadib hadane isku qeybinta aya ku xigi doonto, kadib isku dhufashada, kadib iskudarka iyo ogu dambeen oo la xalin doono kala jarka.

Order: madaama ku jibaaran (to the power) eysan ku jirin xisaabtan hoose Order oo ah ku jibaaran waalaga soconayaa.

				
					console.log(2 * 2 - (2 + 1) / 3); // output: 3
				
			

 

Tusaalahan hoose xisaabta waxa ku jiro to the power iyada ayaana laga bilaabi doona madaama wax bracket ku jiro eysan jirin.

				
					console.log(2 + 2 / 2 ** 2 - 3); // output: -0.5
				
			

 

Aqriste waxaan rajeynaya inaad wax badan ka fahantey Operators Precedence.

Next Lesson >

Share