Срочно! Помогите! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Срочно! Помогите!

Как использовать переменные из PHP в Java Script?

27th Mar 2018, 8:54 PM
Андрей Захаров
Андрей Захаров - avatar
1 Answer
+ 3
You can simply declare variables in JavaScript by using either let or const keywords. Examp#See below: In PHP you declare variables like that: $int = 10; // integer $flt = 3.14; // floating-point number $bool = true; // boolean, it can be false as well $str = 'string'; // string, it can be like "string" as well In JavaScript you can convert the above to: let int = 10; // whole number let flt = 3.14; // decimal number let bool = true; // boolean, it can be false as well let str = 'string'; // string, it can be like "string" as well The const keyword is used when the value of particular variable won't change throughout the program.
27th Mar 2018, 9:18 PM
Denis Marinov
Denis Marinov - avatar