+ 1
Срочно! Помогите!
Как использовать переменные из PHP в Java Script?
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.