[Javascript] How to sum of all its digits for a number


Given a number x, find sum of digits in that number.
Examples:

1. Input n = 8
Output - Sum of digits in number is 8

2. Input n = 1234
Output - Sum of digits in number is 10

3. Input n = - 8
Output - Sum of digits in number is -8

4. Input n = -1234
Output - Sum of digits in number is 8

Step 1: we have to create a demo.html


Step 2: we write the function in javascript to sum of all digits in a number. With 2 ways to declare the function.

The first one: using var num = parseInt(document.getElementById("demo").value); when everything is done, we got the sum. We will use document.getElementById("result").innerHTML = sum to show on web browser.

The second one: using var textType = Node.textContent ? 'textContent' : 'innerText'; Is is the textContent or innerText? You also do something like the first one, but when you get the value for <p> tag. Just using like this result1[textType] = sum;

Let's do it now






[Javascript] How to sum of all its digits for a number

[UWP] The program could not build Windows Universal Samples


If you get this error like this:

"Type universe cannot resolve assembly: System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

"Cannot resolve Assembly or Windows Metadata file 'System.Runtime.dll'"

First, you should check your Updates Windows 10 latest. 

Second, your Microsoft Visual Studio should be the Microsoft Visual Studio 2017.

Finally, go to "Build" -> "Clean Solution". 

And then, go to "Tool" -> click "Options".

We click "Nuget Package Manager" on the left side. Then make sure on the right side, the checkbox "Allow Nuget to download missing packages" and "Automatically check for missing packages during build in Visual Studio" are checked. Then, click "OK".

After you finished all of them, back to the screen click "Build" -> "Build Solution".

[UWP] The program could not build Windows Universal Samples

Tấn công tình dục và ám sát người tại trường học

Một người đàn ông 18 tuổi đã bị bắt với tội danh tấn công chết người vào sáng thứ 4 (28/4) tại trường học Highlands High School ở California.

Cảnh sát đã bắt Neven Glen Butler vì đã tấn công người ở Fair Oaks Boulevard. Sau đó, hắn được xác định là kẻ tấn công người tại trường Highlands High School.

Vào thứ 5, hắn đã bị bắt với tội tấn công vào ngày thứ 4.

Theo điều tra, Butler đã tấn công tình dục (cưỡng hiếp) một phụ nữ 61 tuổi. Sau đó, bạn của người phụ nữ đó phát hiện đã cố đánh trả lại Butler, nhưng bị hắn tấn công lại, và hắn đã giết người phụ nữ đó.

Butler được ra trước tòa vào trưa thứ 6 cho tội tấn công ở Fair Oaks, và sẽ sớm kết tội danh mới là cưỡng hiếp và giết người vào thứ 2 1/5/2017.

Tấn công tình dục và ám sát người tại trường học