I have to create a function which takes a string, and it should return true or false based on whether the input consists of a repeated character sequence. The length of the given string is always greater than 1 and the character sequence must have at least one repetition.
"aa" // true(entirely contains two strings "a")
"aaa" //true(entirely contains three string "a")
"abcabcabc" //true(entirely containas three strings "abc")
"aba" //false(At least there should be two same substrings and nothing more) …Run Code Online (Sandbox Code Playgroud) 我的基本 html 结构如下
我成功地使用grid-template-areas. 我面临的问题是我无法根据需要旋转每一行的瓷砖。
我创建了一个基本片段,每行只有 3 个图块。第一排朝向直角,所有其他排都朝向错误的角度。90deg对于第二行。180deg对于第三行。和270deg第四行。
我试过使用writing-modeandtransform:rotate()但它不起作用或者我使用它的方式错误。请帮我找到正确的方法。我会很感激
*{
box-sizing: border-box;
}
#board {
display: grid;
/*first and last row and column are bigger than others*/
grid-template-columns: 100px repeat(2, 70px) 100px;
grid-template-rows: 100px repeat(2, 70px) 100px;
/*a, b, c, d are 4 rows and o is center*/
grid-template-areas:
"c c c d"
"b …Run Code Online (Sandbox Code Playgroud)在传递空对象的情况下,对象解构会引发错误
function test ({name= 'empty'}={}) {
console.log(name)
}
test(null);Run Code Online (Sandbox Code Playgroud)
未捕获的类型错误:无法解构
name“未定义”或“空”的属性。在测试 (:1:15) 在 :1:1
考虑我们有一个如下所示的函数
const upper = (str: string) : string => string.toUpperCase()
Run Code Online (Sandbox Code Playgroud)
我们可以使用以下方法获取函数的类型ReturnType
type Test = ReturnType<typeof upper>
Run Code Online (Sandbox Code Playgroud)
但现在考虑我们有一个异步函数。
const getUserData = async (uid: string): Promise<{name: string, email: string}> => {
...
};
Run Code Online (Sandbox Code Playgroud)
现在我们怎样才能得到这种类型{name: string, email: string}
How to check if two indexes of a square matrix are diagonal to each other. Consider the array.
[
0 , 1 , 2 , 3 ,
4 , 5 , 6 , 7 ,
8 , 9 , 10, 11,
12, 13, 14, 15
]
Run Code Online (Sandbox Code Playgroud)
Create a function which takes three parameters array and two indexes. It should return a true if two indexes are diagonal to each other otherwise return false For above array.
0,15 => true
3,12 …Run Code Online (Sandbox Code Playgroud) 请投票支持功能请求https://github.com/microsoft/vscode/issues/113463
我正在创建一个扩展程序,我需要自定义建议菜单。我想在建议的末尾添加数字。

我不是要求完整的解决方案。我只是要求启动只是为了编辑自动完成菜单并在其末尾添加一些自定义文本。我搜索了很多,但没有找到编辑自动完成菜单的方法。
编辑:搜索这个我发现它可能链接vscode.CompletionItemProvider
编辑:它不想要特别在行尾的数字。它们可能位于完整项目的开头。
注意:我已经在 github 上打开了一个问题https://github.com/microsoft/vscode/issues/113463
我尝试在控制台中一一写入以下行
let x = y //throws error "Uncaught ReferenceError: y is not defined"
console.log(x) //throws error "ReferenceError: x is not defined"
let x = 3; //gives error "Uncaught SyntaxError: Identifier 'x' has already been declared"
x = 3 //ReferenceError: x is not defined
Run Code Online (Sandbox Code Playgroud)
现在的问题是,如何不能定义变量并同时对其进行声明。两者之间有什么区别。
我有一个包含日期名称的唯一字符串的数组。日期名称将以随机顺序排列。-例如:
["Sun 10am", "Sat 4pm", "Sat 10am", "Wed 3pm", "Sun 4pm"]
Run Code Online (Sandbox Code Playgroud)
我想使用javascript对该数组进行排序,以便它以升序排列。
["Wed 3pm", "Sat 10am", "Sat 4pm", "Sun 10am", "Sun 4pm"]
Run Code Online (Sandbox Code Playgroud)
有人可以建议最好的方法吗?
谢谢
我已经用实体化库做了一个下拉菜单。它包含项目列表。现在我想在所有项目的底部查看更多链接。该链接已成功添加,但问题是当我单击该链接下拉列表/选择被关闭时。
const select = document.querySelector("select");
const fillSelect = (newOptions) => {
const options = select.querySelectorAll("option");
options.forEach((x) => x.remove());
newOptions.forEach((opt) => {
const optionElement = document.createElement("option");
optionElement.innerHTML = opt;
select.appendChild(optionElement);
});
updateSelect();
};
const addViewMoreLink = () => {
const link = document.createElement('div');
link.innerHTML = 'View more';
link.addEventListener('click', e => {
e.preventDefault();
e.stopPropagation();
return false;
})
const dropdownContent = select.parentNode.querySelector(".dropdown-content");
dropdownContent.appendChild(link);
}
const updateSelect = () => {
window.M.FormSelect.init(select, {});
}
window.onload = function(){
fillSelect(["Option 1", "Option 2", "Option 3"]);
addViewMoreLink() …Run Code Online (Sandbox Code Playgroud)Consider an array whose length will be always product of two numbers. For below array l is 4 and w is 5.
There is also a given index. I want to get the two arrays containing elements which lie on the diagonal line which passes through that particular index.
[
0, 1, 2, 3, 4
5, 6, 7, 8, 9
10, 11, 12, 13, 14
15, 16, 17, 18, 19
]
index = 7 => [3, 7, 11, 15] …Run Code Online (Sandbox Code Playgroud) javascript ×9
algorithm ×4
arrays ×2
css ×2
html ×2
css-grid ×1
ecmascript-6 ×1
materialize ×1
node.js ×1
sorting ×1
string ×1
typescript ×1
variables ×1