var user = ("Bob", 37);
var str = user switch {
("Tom", 36) => "name: Tom, age: 36",
("Bob", 37) => "name: Bob, age: 37",
_ => "Undefined"
}
Console.Writeline(str);
let obj = {
x: 10,
y: 'hello',
[Symbol('new')]: 'world'
};
const s = Symbol('new');
let obj = {
x: 10,
y: 'hello',
[s]: 'world'
};
console.log(obj[s]);
.block {
width: 120px;
height: 40px;
background: red;
position: relative;
}
.block:before {
content: '';
background: blue;
width: 100%;
height: 100%;
position: absolute;
top: 50%;
z-index: -1;
}
Не удалось загрузить сценарий модуля: ожидался сценарий модуля JavaScript, но сервер ответил типом MIME «text / html». Для скриптов модуля в соответствии со спецификацией HTML применяется строгая проверка типов MIME.
const Figure = ({ type, ...props }) => <div className={type} {...props}></div>;
class App extends React.Component {
state = {
types: [ 'circle', 'square', 'triangle' ],
figures: [],
}
add(type) {
this.setState(({ figures }) => ({
figures: [ ...figures, type ],
}));
}
render() {
const { types, figures } = this.state;
return (
<div>
<div>
{types.map(n => <Figure type={n} onClick={() => this.add(n)} />)}
</div>
<div>
{figures.map(n => <Figure type={n} />)}
</div>
</div>
);
}
}
.NET
.NET Core
ASP NET Core
ASP NET Core 5
ASP NET Core 5 MVC
Что к чему? Что самое свежее/актуальное сейчас?
const arrs = [ arr1, arr2 ];
), дальше есть варианты:const result = arrs[0].map((_, i) => arrs.flatMap(arr => arr[i]));
const result = arrs.reduce((acc, arr) => (
arr.forEach((n, i) => (acc[i] ??= []).push(...n)),
acc
), []);
const result = [];
for (const arr of arrs) {
for (const [ i, n ] of arr.entries()) {
if (!result[i]) {
result[i] = [];
}
for (const m of n) {
result[i][result[i].length] = m;
}
}
}
function* zip(data, defaultValue = null) {
const iterators = Array.from(data, n => n[Symbol.iterator]());
for (let doneAll = false; doneAll = !doneAll;) {
const values = [];
for (const n of iterators) {
const { value, done } = n.next();
values.push(done ? defaultValue : value);
doneAll &&= done;
}
if (!doneAll) {
yield values;
}
}
}
const result = Array.from(zip(arrs), n => n.flat());
using ManagedNativeWifi;
var connections = NativeWifi.EnumerateInterfaceConnections();
var firstConnection = connections.First();
Console.WriteLine(firstConnection.ProfileName);
fetch('https://gorest.co.in/public/v1/posts')
.then(r => r.json())
.then(r => {
// собираем разметку
document.body.insertAdjacentHTML('beforeend', `
<ul>${r.data.map(n => `
<li>
<a>${n.title}</a>
</li>`).join('')}
</ul>
`);
// или, создаём элементы напрямую
const ul = document.createElement('ul');
ul.append(...r.data.map(n => {
const li = document.createElement('li');
const a = document.createElement('a');
a.textContent = n.title;
li.append(a);
return li;
}));
document.body.append(ul);
});
class Program
{
static void Main(string[] args)
{
double N;
double M;
Console.WriteLine("Введите N: ");
N=Convert.ToInt64(Console.ReadLine());
int i = -1;
while (i < N)
{
i = i+1;
M = i; //Выводим значение из цикла while
Console.WriteLine(i);
}
Console.WriteLine(M); // Мне нужно, чтобы здесь выводилось значение из цикла while
}
}