Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have this declared in my class:
somePair: KVPair;
Where KVPair is just a key value pair JSON.
Then in my displayFN I set it like so:
displayFn(pair: KVPair) {
this.somePair = pair;
}
But when I console.log(somePair) outside of displayFn, it's undefined, and I'm not sure why.
I was trying to set it with a [displayWith] which was clearing somePair.
When I set it in (optionSelected)="someFunction($event.option.value)", the value stuck around.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 days ago.
Improve this question
eg:
class X
{
void accept()-accepts a string
void update(X m)-compares string m and current object
so I'm not able to understand what we have to do in the update method
so that was my query.pls help me with it
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
So I’m trying to check names through an array and I don’t want to have to use
if (<array name>[0,1,2,3,4,5,6,7])
{ code in here }
depend on what you are trying to do u can use forEach or map
let arr = [1,2,3,4,5,6,7,8,9,10];
arr.forEach((item)=>{
console.log(`${item} is greater than 5 : ${item>5}`)
})
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
How to Display each variable of for loop in a div tag using javascript? Using innerHTML i am only able to display the last variable of for loop
You can do as follows, but it is better to use lists.
Lists: https://developer.mozilla.org/pt-BR/docs/Web/HTML/Element/ul
const myDreams = ["Fly", "Be rich", "Go to the moon"];
const myDreamsDiv = document.querySelector("#myDreams");
//The secret here is to add a breakline(<br>) between each word.
myDreams.forEach(dream => myDreamsDiv.innerHTML += (dream + "<br>"));
<div id="myDreams"></div>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have a string
var str="[a54hy 8:45pm],[f57gh 9:20]"
i need to get
[f57gh 9:20pm]
I don't want to use split since the string length can be anything
This worked for me. where id is f57gh
var re='\\['+id + '([a-z0-9: ]+)\\]';
var rematch=RegExp(re,'g');
var mydata=str.match(rematch);
alert(mydata); //[f57gh 9:11am]
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have d1 and d2 set in hour:minute:seconds format... How can I compare two time variables and if first is greater execute the function.
In short.
if(d1>d2)
{
//run function
}
Look this
Date.parse('01/01/2011 10:20:45') > Date.parse('01/01/2011 5:10:10')