class User {
constructor(username, password) {
this.username = username;
this.password = password;
}
}
const bd = [];
function addUser(username = '', password = '') {
if(username.length <= 0 && password.length <= 0) return;
bd.push(new User(username, password))
}
addUser('Login', 'password')
addUser()
addUser('Login2', 'password2')
console.log(bd)
if(this.classList.contains('create_button')){
this.classList.toggle('exit')
block_2.style.opacity = 1;
}
if(this.classList.contains('exit')){
this.classList.toggle('create_button')
block_2.style.opacity = 0;
}
setInterval(() => {
const currentMin = new Date().getMinutes();
if (currentMin % 4 === 0) { // будет срабатывать каждую секунду на протяжении минуты доработай условие, если нужно 1 раз
console.log(currentMin)
}
}, 1000)
const arr = [
[
{name: 'One'},
{name: 'Two'},
{name: 'Three'},
]
];
let str = '';
for(let i = 0; i < arr[0].length; i++) {
str = str + arr[0][i].name;
}
console.log(str) // "OneTwoThree"
i <= arr[0].length
на последней итерации равна 3, но элемента массива 3 нет. И лучше определять переменные и называть лучше, а то ты итерируешь объект, а не массив судя по имени переменной upstream serve {
server 0.0.0.0:8081;
keepalive 15;
}
server {
listen 80;
listen [::]:80;
# Add index.php to the list if you are using PHP
access_log /var/log/nginx/mushroomer.access.log;
error_log /var/log/nginx/mushroomer.error.log;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://serve;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
upstream client-upstream {
server 0.0.0.0:3000;
keepalive 15;
}
upstream back-upstream {
server 0.0.0.0:8000;
keepalive 15;
}
server {
listen ${HOST_IP}80;
server_name ${PROJECT_NAME} www.${PROJECT_NAME};
server_tokens off;
root /var/www/prod/public;
index index.php index.html index.htm;
location / {
proxy_pass http://client-upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_upgrade;
proxy_set_header Host $host;
}
location /api {
proxy_pass http://back-upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
let url = new URL(window.location.href);, что будет равно 127.0.0.1:3000
let url = new URL('http://' + window.location.host)
MY_VAR="Hello world" node my-script.js
// my-script.js
console.log(process.env.MY_VAR) //Hello world
MY_VAR="Hello world" npx playwright test
$('#Addworker').on('submit', function(e){
e.preventDefault();
let login = $('#login').val();
let password = $('#password').val();
var data = {"do": "AddWorker",'login': login, 'password': password};
fetch(`/workers`, {
method: 'POST',
contentType: "application/json",
body: JSON.stringify(data)
})
.then(function(response){
return response.json()
})
.then(function (res) {
ObrabotkaAddWorker(res)
})
})
<link>