Array judgment value, array value

Source: Internet
Author: User

Array judgment value, array value
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<Html lang = "en">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title> Document </title>
<Style>
/* Start css reset */
Body, h1, h2, h3, h4, h5, h6, p, dl, dd, ul, ol, pre, form, input, textarea, th, td, select {margin: 0; padding: 0; font-size: 14px; font-family: "Microsoft Yahei ";}
Input {width: 300px; height: 20px; vertical-align: middle ;}
Li {list-style: none; vertical-align: top ;}
A {text-decoration: none ;}
Img {border: none; vertical-align: top ;}
Table {border-collapse: collapse ;}
Textarea {resize: none; overflow: auto ;}
Body {margin-top: 10px ;}
/* Css reset ends */
Form {width: 300px ;}
Fieldset {margin: 20px; border: 2px dashed palevioletred ;}
</Style>
<Script>
Window. onload = function (){
Var arr = ['100px ', 'abc'-6, [],-98765, 34,-2, 0, '123', function () {alert (1) ;}, null, document, [], true, '200px '-30, '23. 45 RMB ', 5, Number ('abc'), function () {alert (3) ;}, 'xyz'-90];


Var oAllnum = document. getElementById ('allnum ');
Var oNum = document. getElementById ('num ');
Var oMaxNum = document. getElementById ('maxnum ');
Var oNanLocation = document. getElementById ('nanlocation ');
Var arr1 = [];
Var arr2 = [];
Var arr3 = [];


//1. All the numbers in the array: digit numbers
For (var I = 0; I <arr. length; I ++ ){
If (typeof arr [I] = 'number' & arr [I] = arr [I]) {
Arr1.push (arr [I]);
}
}
OAllnum. value = arr1;


//2. the array can be converted to a numeric value: linear regression.


For (var I = 0; I <arr. length; I ++ ){
If (isNaN (parseInt (arr [I]) = false ){
Arr2.push (arr [I]);
}
}
ONum. value = arr2;


//3. You can convert the value to a number and then obtain the maximum value: ↓
Var tmp = arr2;


Var max = tmp [0];


For (var I = 1; I <tmp. length; I ++ ){


If (max <tmp [I])
{
Max = tmp [I];
}


}
OMaxNum. value = max;




// 4. The location of NAN: zookeeper
For (var I = 0; I <arr. length; I ++ ){
If (typeof arr [I] = 'number' & isNaN (number (arr [I]) {
Arr3.push (I );
}
}
ONanLocation. value = arr3;
}
</Script>
</Head>
<Body>
<Form action = "">
<Fieldset>
<Legend> output result </legend>
All numbers in the arr array: <input type = "text" id = "allNum"/> <br/>
The arr array can be converted into numbers: <input type = "text" id = "Num"/> <br/>
After the number is converted, the maximum value is obtained: <input type = "text" id = "maxNum"/> <br/>
NaN location: <input type = "text" id = "nanLocation"/>
</Fieldset>
</Form>
</Body>
</Html>
PHP array value problems?

I wrote a function to find the record, and made some general extension. Let's use it together. The following is the test code:

$ A = array (
Array ('id' => 1, 'version' => 'A '),
Array ('id' => 2, 'version' => 'B '),
Array ('id' => 3, 'version' => 'C '),
Array ('id' => 4, 'version' => 'D '),
Array ('id' => 5, 'version' => 'E '),
Array ('id' => 6, 'version' => 'F '),
Array ('id' => 7, 'version' => 'G '),
Array ('id' => 8, 'version' => 'H '),
Array ('id' => 9, 'version' => 'I '),
Array ('id' => 10, 'version' => 'J '),
Array ('id' => 11, 'version' => 'k '),
Array ('id' => 12, 'version' => 'l '),
Array ('id' => 13, 'version' => 'M '),
Array ('id' => 14, 'version' => 'n '),
Array ('id' => 15, 'version' => 'O '),
Array ('id' => 16, 'version' => 'P '),
Array ('id' => 17, 'version' => 'q '),
Array ('id' => 18, 'version' => 'R '),
Array ('id' => 19, 'version' =>'s '),
Array ('id' => 20, 'version' => 'T ')
);

/**
* N adjacent records are returned. If an empty array is returned, this record is not found.
* $ Records is the record array, $ id is the record to be searched, and $ num is the number of records to be returned. The default value is 10.
*/
Function getRecords ($ r ...... remaining full text>

EXCEL Array Value Problems

C1 to Z1 is the date. What is the date? So many dates?
What does it mean if it is not null? Unclear. How can this problem be solved?
Send original file to sm100e@qq.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.