aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/javascript/referencia/objetos_globales/string/codepointat/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/es/web/javascript/referencia/objetos_globales/string/codepointat/index.html')
-rw-r--r--files/es/web/javascript/referencia/objetos_globales/string/codepointat/index.html127
1 files changed, 0 insertions, 127 deletions
diff --git a/files/es/web/javascript/referencia/objetos_globales/string/codepointat/index.html b/files/es/web/javascript/referencia/objetos_globales/string/codepointat/index.html
deleted file mode 100644
index ae3fef3ec8..0000000000
--- a/files/es/web/javascript/referencia/objetos_globales/string/codepointat/index.html
+++ /dev/null
@@ -1,127 +0,0 @@
----
-title: String.prototype.codePointAt()
-slug: Web/JavaScript/Referencia/Objetos_globales/String/codePointAt
-translation_of: Web/JavaScript/Reference/Global_Objects/String/codePointAt
----
-<div>{{JSRef}}</div>
-
-<div> </div>
-
-<div>El método <strong><code>codePointAt() </code></strong><code>d</code>evuelve un entero no negativo que equivale al valor Unicode code point del carácter.</div>
-
-<h2 id="Sintaxis">Sintaxis</h2>
-
-<pre class="syntaxbox"><code><var>str</var>.codePointAt(<var>indice</var>)</code></pre>
-
-<h3 id="Parámetros">Parámetros</h3>
-
-<dl>
- <dt><code>indice</code></dt>
- <dd>Índice del carácter en la cadena del que se quiere obtener el valor del Unicode code point.</dd>
-</dl>
-
-<h3 id="Valor_de_retorno">Valor de retorno</h3>
-
-<p>Un número que equivale al valor code point del carácter especificado en el índice de la cadena; devuelve {{jsxref("undefined")}} si no se encuentra carácter en la posición especifica.</p>
-
-<h2 id="Description">Description</h2>
-
-<p>If there is no element at the specified position, {{jsxref("undefined")}} is returned. If no UTF-16 surrogate pair begins at <code>pos</code>, the code unit at <code>pos</code> is returned.</p>
-
-<h2 id="Examples">Examples</h2>
-
-<h3 id="Using_codePointAt()">Using <code>codePointAt()</code></h3>
-
-<pre class="brush: js">'ABC'.codePointAt(1); // 66
-'\uD800\uDC00'.codePointAt(0); // 65536
-
-'XYZ'.codePointAt(42); // undefined
-</pre>
-
-<h2 id="Polyfill">Polyfill</h2>
-
-<p>The following extends Strings to include the <code>codePointAt()</code> function as specified in ECMAScript 2015 for browsers not supporting it natively.</p>
-
-<pre class="brush: js">/*! http://mths.be/codepointat v0.1.0 by @mathias */
-if (!String.prototype.codePointAt) {
- (function() {
- 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
- var codePointAt = function(position) {
- if (this == null) {
- throw TypeError();
- }
- var string = String(this);
- var size = string.length;
- // `ToInteger`
- var index = position ? Number(position) : 0;
- if (index != index) { // better `isNaN`
- index = 0;
- }
- // Account for out-of-bounds indices:
- if (index &lt; 0 || index &gt;= size) {
- return undefined;
- }
- // Get the first code unit
- var first = string.charCodeAt(index);
- var second;
- if ( // check if it’s the start of a surrogate pair
- first &gt;= 0xD800 &amp;&amp; first &lt;= 0xDBFF &amp;&amp; // high surrogate
- size &gt; index + 1 // there is a next code unit
- ) {
- second = string.charCodeAt(index + 1);
- if (second &gt;= 0xDC00 &amp;&amp; second &lt;= 0xDFFF) { // low surrogate
- // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
- return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
- }
- }
- return first;
- };
- if (Object.defineProperty) {
- Object.defineProperty(String.prototype, 'codePointAt', {
- 'value': codePointAt,
- 'configurable': true,
- 'writable': true
- });
- } else {
- String.prototype.codePointAt = codePointAt;
- }
- }());
-}
-</pre>
-
-<h2 id="Specifications">Specifications</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName('ES2015', '#sec-string.prototype.codepointat', 'String.prototype.codePointAt')}}</td>
- <td>{{Spec2('ES2015')}}</td>
- <td>Initial definition.</td>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-string.prototype.codepointat', 'String.prototype.codePointAt')}}</td>
- <td>{{Spec2('ESDraft')}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility">Browser compatibility</h2>
-
-<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
-
-<p>{{Compat("javascript.builtins.String.codePointAt")}}</p>
-
-<h2 id="See_also">See also</h2>
-
-<ul>
- <li>{{jsxref("String.fromCodePoint()")}}</li>
- <li>{{jsxref("String.fromCharCode()")}}</li>
- <li>{{jsxref("String.prototype.charCodeAt()")}}</li>
- <li>{{jsxref("String.prototype.charAt()")}}</li>
-</ul>