Software programing
Ir al canal en Telegram
This is a channel which gives tutorial on different programming languages, android tips and tricks best apps etc...
Mostrar más1 471
Suscriptores
Sin datos24 horas
Sin datos7 días
Sin datos30 días
Archivo de publicaciones
1 471
js answer:
let incrementString = str => str.replace(/([0-8]|\d?9+)?$/, (e) => e ? + e + 1 : 1)
function incrementString (strng) {
return strng.replace(/(\d*)$/, (_, p1) => p1 ? String(+p1 + 1).padStart(p1.length, 0) : 1);
}
function incrementString (strng) {
var m = strng.match(/^(\w*?)(\d*)$/);
var next = (parseInt('0'+m[2], 10) + 1) + '';
return m[1] + m[2].slice(0, -next.length) + next;
}
more....
1 471
write a function which increments a string, to create a new string.
If the string already ends with a number, the number should be incremented by 1.
If the string does not end with a number. the number 1 should be appended to the new string.
Examples:
foo -> foo1
foobar23 -> foobar24
foo0042 -> foo0043
foo9 -> foo10
foo099 -> foo100
Attention: If the number has leading zeros the amount of digits should be considered.
1 471
L, 03.06.20 06:20
Photo
The rgb function is incomplete. Complete it so that passing in RGB decimal values will result in a hexadecimal representation being returned. Valid decimal values for RGB are 0 - 255. Any values that fall out of that range must be rounded to the closest valid value.
Note: Your answer should always be 6 characters long, the shorthand with 3 will not work here.
The following are examples of expected output values:
rgb(255, 255, 255) // returns FFFFFF
rgb(255, 255, 300) // returns FFFFFF
rgb(0,0,0) // returns 000000
rgb(148, 0, 211) // returns 9400D3
so the function accept 3 number 0-255 and will return hex values...
Try your answer and simple js answer in the comments
1 471
Responsive Web And Desktop Development With Flutter — Smashing Magazine
via www.smashingmagazine.com
1 471
https://stackblitz.com/ ** StackBlitz is an online editor much like vs-code which will allow you to edit/prototype your code, you can use react, angular, svelte.... with out the need to install 3rd party packages***
1 471
JS answer:
function capital(capitals){
return capitals.length > 0 ? capitals.map(cap =>
The capital of ${cap[Object.keys(cap)[0]]} is ${cap[Object.keys(cap)[1]]}) : "No Information Given..."
}
function capital(capitals) {
return capitals.map(function(e) {
return 'The capital of ' + (e.state || e.country) + ' is ' + e.capital
})
}
function capital(capitals){
return capitals.map(c => The capital of ${c.state||c.country} is ${c.capital});
}
function capital(capitals){
return capitals.map(function (hash) {
return Object.keys(hash).reduce(function (a, b) {
return 'The capital of ' + hash[a] + ' is ' + hash[b]
})
})
}1 471
Write a method that takes a sequence of objects with two keys each: country or state, and capital. Keys may be symbols or strings
The method should return an array of sentences declaring the state or country and its capital.
{state: 'Maine', capital: 'Augusta'}
should return
"The capital of Maine is Augusta"
{'country' : 'Spain', 'capital' : 'Madrid'}
"The capital of Spain is Madrid"
[{"state" : 'Maine', capital: 'Augusta'}, {country: 'Spain', "capital" : "Madrid"}]
["The capital of Spain is Madrid", "The capital of Maine is Augusta"]
