Javascript language

R4R® Javascript Javascript Example
(追記) (追記ここまで)
(追記) (追記ここまで)
eval() Method in JavaScript

Evaluates or executes an argument

If the argument is an expression, eval() evaluates the expression

If the argument is one or more JavaScript statements, eval() executes the statements

Syntax:

eval string

For example

<html>
<body>
<script language="javascript">
function fun_name(){
 var full_name = 'Aditya Tiwari';
 var mySentence = eval('"My name is " + full_name');
 alert(mySentence); 
}
</script>
<button onclick="fun_name()">Eval function</button>
</body>
</html>

Output:

floor()Method

The floor() method rounds a number to the nearest integer, and returns the result.

syntax:
Math.floor (value) 

For Example

<html>
<body>
<script language="javascript">
function math_val(){
 var val = 1.1;
 var stat = eval('"Actual value is=" + val +" 
	 "+ "After truncate value is= " + Math.floor(1.1)');
 alert(stat); 
}
</script>
<button onclick="math_val()">FLOOR</button>
</body>
</html>
(追記) (追記ここまで)

Output:

(追記) (追記ここまで)
Copyright ©2021-22 r4r.co.in, all rights reserved. Theguestspost.com
Sitemap
Career
Post comment
About us
Subscription
Unsubscription

AltStyle によって変換されたページ (->オリジナル) /