serverTalk().then(console.log).then(serverTalk).then(console.log);
serverTalk().then(function(result) {
console.log(result);
}).then(function() {
return serverTalk();
}).then(function(result) {
console.log(result);
});
serverTalk()
.then(result => console.log(result))
.then(() =>serverTalk())
.then(result => console.log(result));
var res = `${x > 5 && (y == 7.5)}`;
const Splitter = require("split-tools");
var text = "x > 5 && (y == 7.5) || sin(Math.PI*a/360) || true";
const splitter = new Splitter({
matchers: {
function: /\s*([a-z]\w*)\(\s*(.*)\s*\)/g,
bracket: /\(\s*(.*)\s*\)/g,
operator: /\s*(\>|\<|\=\=|\!\=|\&\&|\|\||\+|\-|\*|\/|\%)\s*/g,
variable: /\s*([a-z][\w\.]*)\s*/gi,
sting: /\s*\"(.*?)\"\s*/gi,
boolean: /\s*(true|false)\s*/gi,
value: /\s*(\d[\d\.]*)\s*/gi
}
});
const tree = {
"brackets": ["function", "bracket", "operator", "variable", "sting", "boolean", "value"]
};
function subSplit(id, text) {
console.log("subSplit:", id, "[", text, "]");
if(tree[id] && tree[id].length)
return splitter.process(text, tree[id]);
return text;
}
splitter.addParser("function",(match,name,body)=>{
return {
type: "function",
name: name,
body: subSplit("brackets", body)
};
});
splitter.addParser("bracket",(match,body)=>{
return {
type: "bracket",
body: subSplit("brackets", body)
};
});
splitter.addParser("operator",(match,body)=>{
return {
type: "operator",
body: body
};
});
splitter.addParser("variable",(match,body)=>{
return {
type: "variable",
body: body
};
});
splitter.addParser("string",(match,body)=>{
return {
type: "string",
body: body
};
});
splitter.addParser("boolean",(match,body)=>{
return {
type: "boolean",
body: !!body
};
});
splitter.addParser("value",(match,body)=>{
return {
type: "value",
body: +body
};
});
const list = splitter.process(text, tree.tags);
console.log("\n\nresult:\n",JSON.stringify(list, null, ' '));
[
{ "type": "variable", "body": "x" },
{ "type": "operator", "body": ">" },
{ "type": "value", "body": 5 },
{ "type": "operator", "body": "&&" },
{ "type": "bracket", "body": [
{ "type": "variable", "body": "y" },
{ "type": "operator", "body": "==" },
{ "type": "value", "body": 7.5 }
]
},
{ "type": "operator", "body": "||" },
{ "type": "function", "name": "sin", "body": [
{ "type": "variable", "body": "Math.PI" },
{ "type": "operator", "body": "*" },
{ "type": "variable", "body": "a" },
{ "type": "operator", "body": "/" },
{ "type": "value", "body": 360 }
]
},
{ "type": "operator", "body": "||" },
{ "type": "variable", "body": "true" }
]
let o = {
x : 2,
y : o.x,
}
let workingLine = function() {
firstLetter = workingLine[0]
firstLetter.match( /[a-z]|[а-я]/g )
0
, которого нет, т.е., получаете undefined
, и у этого undefined
пытаетесь вызвать строковый метод..b-popup
появляется, он закрывает собой .b-block
, возникает событие mouseleave, и его надо скрывать. А как он скрылся - его надо снова показывать, потому что на .b-block
возникает событие mouseenter. Ну вот так оно по кругу и происходит.pointer-events: none
для .b-popup
. Или поместите .b-popup
внутрь .b-block
. const arr = [...Array(100)].map((_, i) => i + 1);
const res = arr.map(n => `${n % 3 ? '' : 'Foo'}${n % 5 ? '' : 'Bar'}` || n);
$.ajax({
type: 'POST',
url: 'zakaz.php,
data: $("#zakaz").serialize(),
success: function(data) {
$('#zakaz').find('input[type=text],input[type=tel],input[type=email], textarea').val('');
$('#zakaz').find("input[type=checkbox], input[type=radio]").prop("checked", "");
}
});
макросы в С++
#include <iostream>
template<typename T>
auto sqr = [](T x)
{
return x * x;
};
int main()
{
std::cout << sqr<int>(3 + 0);
}
//...
class __lambda_3_12
{
public: inline int operator()(int x) const
{
return x * x;
}
//...
};
//...