Strong Root

1
2
3
4
5
6
age = Number(age);
if (isNaN(age)) {
    voteable = "Error in input";
else {
    voteable = (age < 18) ? "Too young" : "Old enough";
}
cs






출처 : http://www.w3schools.com/js/js_comparisons.asp

"" (empty string) 의 Boolean 값은 false 다.

1
2
var x = "";
Boolean(x);       // returns false
cs




undefined 의 Boolean 값은 false 다.

1
2
var x;
Boolean(x);       // returns false
cs




null 의 Boolean 값은 false 다.

1
2
var x = null;
Boolean(x);       // returns false
cs






그렇다면 String값의 이상유무를 확인할 때, 아래와 같이 써주면 끝?

1
2
3
4
5
6
if (x) {
    // valid
}
else {
    // invalid
}
cs




틀렸다면 이유를 알려주시면 감사합니다.






출처 : http://www.w3schools.com/js/js_booleans.asp + 내추측

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ThreadGroup rootGroup = Thread.currentThread().getThreadGroup();
ThreadGroup parentGroup;
while ((parentGroup = rootGroup.getParent()) != null) {
    rootGroup = parentGroup;
}
 
Thread[] threads = new Thread[rootGroup.activeCount()];
while (rootGroup.enumerate(threads, true== threads.length) {
    threads = new Thread[threads.length * 2];
}
 
for (Thread t : threads) {
    if (t.getId() == targetID) {
        /* found it */
    }
}
cs






출처 :

http://stackoverflow.com/a/1323480

http://stackoverflow.com/a/6668121

1
2
3
4
5
var myNumber = 128;
 
myNumber.toString(16);    // returns 80
myNumber.toString(8);    // returns 200
myNumber.toString(2);    // returns 10000000
cs






출처 : http://www.w3schools.com/js/js_numbers.asp